/** * Use the IMAP IDLE command (see * <A HREF="http://www.ietf.org/rfc/rfc2177.txt">RFC 2177</A>), * if supported by the server, to enter idle mode so that the server * can send unsolicited notifications of new messages arriving, etc. * without the need for the client to constantly poll the server. * Use an appropriate listener to be notified of new messages or * other events. When another thread (e.g., the listener thread) * needs to issue an IMAP comand for this folder, the idle mode will * be terminated and this method will return. Typically the caller * will invoke this method in a loop. <p> * * The mail.imap.minidletime property enforces a minimum delay * before returning from this method, to ensure that other threads * have a chance to issue commands before the caller invokes this * method again. The default delay is 10 milliseconds. * * @exception MessagingException if the server doesn't support the * IDLE extension * @exception IllegalStateException if the folder isn't open * * @since JavaMail 1.4.1 */ public void idle() throws MessagingException { idle(false); }
/** * Use the IMAP IDLE command (see * <A HREF="http://www.ietf.org/rfc/rfc2177.txt">RFC 2177</A>), * if supported by the server, to enter idle mode so that the server * can send unsolicited notifications of new messages arriving, etc. * without the need for the client to constantly poll the server. * Use an appropriate listener to be notified of new messages or * other events. When another thread (e.g., the listener thread) * needs to issue an IMAP comand for this folder, the idle mode will * be terminated and this method will return. Typically the caller * will invoke this method in a loop. <p> * * The mail.imap.minidletime property enforces a minimum delay * before returning from this method, to ensure that other threads * have a chance to issue commands before the caller invokes this * method again. The default delay is 10 milliseconds. * * @exception MessagingException if the server doesn't support the * IDLE extension * @exception IllegalStateException if the folder isn't open * * @since JavaMail 1.4.1 */ public void idle() throws MessagingException { idle(false); }
new Date(System.currentTimeMillis() + this.cancelIdleInterval)); if (imapFolder.isOpen()) { imapFolder.idle();
while (true) { IMAPFolder f = (IMAPFolder)inbox; f.idle(); }
/** * Use the IMAP IDLE command (see * <A HREF="http://www.ietf.org/rfc/rfc2177.txt">RFC 2177</A>), * if supported by the server, to enter idle mode so that the server * can send unsolicited notifications of new messages arriving, etc. * without the need for the client to constantly poll the server. * Use an appropriate listener to be notified of new messages or * other events. When another thread (e.g., the listener thread) * needs to issue an IMAP comand for this folder, the idle mode will * be terminated and this method will return. Typically the caller * will invoke this method in a loop. <p> * * The mail.imap.minidletime property enforces a minimum delay * before returning from this method, to ensure that other threads * have a chance to issue commands before the caller invokes this * method again. The default delay is 10 milliseconds. * * @exception MessagingException if the server doesn't support the * IDLE extension * @exception IllegalStateException if the folder isn't open * * @since JavaMail 1.4.1 */ public void idle() throws MessagingException { idle(false); }
/** * Use the IMAP IDLE command (see * <A HREF="http://www.ietf.org/rfc/rfc2177.txt">RFC 2177</A>), * if supported by the server, to enter idle mode so that the server * can send unsolicited notifications of new messages arriving, etc. * without the need for the client to constantly poll the server. * Use an appropriate listener to be notified of new messages or * other events. When another thread (e.g., the listener thread) * needs to issue an IMAP comand for this folder, the idle mode will * be terminated and this method will return. Typically the caller * will invoke this method in a loop. <p> * * The mail.imap.minidletime property enforces a minimum delay * before returning from this method, to ensure that other threads * have a chance to issue commands before the caller invokes this * method again. The default delay is 10 milliseconds. * * @exception MessagingException if the server doesn't support the * IDLE extension * @exception IllegalStateException if the folder isn't open * * @since JavaMail 1.4.1 */ public void idle() throws MessagingException { idle(false); }
/** * Use the IMAP IDLE command (see * <A HREF="http://www.ietf.org/rfc/rfc2177.txt">RFC 2177</A>), * if supported by the server, to enter idle mode so that the server * can send unsolicited notifications of new messages arriving, etc. * without the need for the client to constantly poll the server. * Use an appropriate listener to be notified of new messages or * other events. When another thread (e.g., the listener thread) * needs to issue an IMAP comand for this folder, the idle mode will * be terminated and this method will return. Typically the caller * will invoke this method in a loop. <p> * * The mail.imap.minidletime property enforces a minimum delay * before returning from this method, to ensure that other threads * have a chance to issue commands before the caller invokes this * method again. The default delay is 10 milliseconds. * * @exception MessagingException if the server doesn't support the * IDLE extension * @exception IllegalStateException if the folder isn't open * * @since JavaMail 1.4.1 */ public void idle() throws MessagingException { idle(false); }
/** * Use the IMAP IDLE command (see * <A HREF="http://www.ietf.org/rfc/rfc2177.txt">RFC 2177</A>), * if supported by the server, to enter idle mode so that the server * can send unsolicited notifications of new messages arriving, etc. * without the need for the client to constantly poll the server. * Use an appropriate listener to be notified of new messages or * other events. When another thread (e.g., the listener thread) * needs to issue an IMAP comand for this folder, the idle mode will * be terminated and this method will return. Typically the caller * will invoke this method in a loop. <p> * * The mail.imap.minidletime property enforces a minimum delay * before returning from this method, to ensure that other threads * have a chance to issue commands before the caller invokes this * method again. The default delay is 10 milliseconds. * * @exception MessagingException if the server doesn't support the * IDLE extension * @exception IllegalStateException if the folder isn't open * * @since JavaMail 1.4.1 */ public void idle() throws MessagingException { idle(false); }
/** * Use the IMAP IDLE command (see * <A HREF="http://www.ietf.org/rfc/rfc2177.txt">RFC 2177</A>), * if supported by the server, to enter idle mode so that the server * can send unsolicited notifications of new messages arriving, etc. * without the need for the client to constantly poll the server. * Use an appropriate listener to be notified of new messages or * other events. When another thread (e.g., the listener thread) * needs to issue an IMAP comand for this folder, the idle mode will * be terminated and this method will return. Typically the caller * will invoke this method in a loop. <p> * * The mail.imap.minidletime property enforces a minimum delay * before returning from this method, to ensure that other threads * have a chance to issue commands before the caller invokes this * method again. The default delay is 10 milliseconds. * * @exception MessagingException if the server doesn't support the * IDLE extension * @exception IllegalStateException if the folder isn't open * * @since JavaMail 1.4.1 */ public void idle() throws MessagingException { idle(false); }
protected void waitingForMails() { try { mailService.ensureOpenFolder(folder); LOGGER.debug("waiting for mails"); folder.idle(); } catch (Exception e) { LOGGER.warn("exception while waiting for mails", e); } }
Thread.sleep(1000); return null; }).given(folder).idle();
shouldFindMessagesCounter.set(1); return null; }).given(folder).idle();
@Override protected void waitForNewMessages(Folder folder) throws MessagingException, InterruptedException { Assert.isInstanceOf(IMAPFolder.class, folder); IMAPFolder imapFolder = (IMAPFolder) folder; // retrieve unseen messages before we enter the blocking idle call if (searchForNewMessages(folder).length > 0) { return; } if (messageCountListener == null) { createMessageCountListener(); } folder.addMessageCountListener(messageCountListener); try { imapFolder.idle(); } finally { folder.removeMessageCountListener(messageCountListener); } }
@Override protected void waitForNewMessages(Folder folder) throws MessagingException, InterruptedException { Assert.isInstanceOf(IMAPFolder.class, folder); IMAPFolder imapFolder = (IMAPFolder) folder; // retrieve unseen messages before we enter the blocking idle call if (searchForNewMessages(folder).length > 0) { return; } if (messageCountListener == null) { createMessageCountListener(); } folder.addMessageCountListener(messageCountListener); try { imapFolder.idle(); } finally { folder.removeMessageCountListener(messageCountListener); } }
@Override protected void waitForNewMessages(Folder folder) throws MessagingException, InterruptedException { Assert.isInstanceOf(IMAPFolder.class, folder); IMAPFolder imapFolder = (IMAPFolder) folder; // retrieve unseen messages before we enter the blocking idle call if (searchForNewMessages(folder).length > 0) { return; } if (messageCountListener == null) { createMessageCountListener(); } folder.addMessageCountListener(messageCountListener); try { imapFolder.idle(); } finally { folder.removeMessageCountListener(messageCountListener); } }
new Date(System.currentTimeMillis() + this.cancelIdleInterval)); if (imapFolder.isOpen()) { imapFolder.idle();