public class PollingMonitoringStrategy extends AbstractMonitoringStrategy
MonitoringStrategy
interface that uses a simple polling mechanism. Defines a polling interval
property which defines the interval in between message polls.
Note that this implementation is not suitable for use with POP3 servers. Use the Pop3PollingMonitoringStrategy
instead.
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_POLLING_FREQUENCY
Defines the default polling frequency.
|
logger
Constructor and Description |
---|
PollingMonitoringStrategy() |
Modifier and Type | Method and Description |
---|---|
protected void |
afterSleep(javax.mail.Folder folder)
Invoked after the
Thread.sleep(long) method has been invoked. |
void |
setPollingInterval(long pollingInterval)
Sets the interval used in between message polls, in milliseconds.
|
protected void |
waitForNewMessages(javax.mail.Folder folder)
Template method that blocks until new messages arrive in the given folder.
|
deleteMessages, fetchMessages, getFolderOpenMode, monitor, searchForNewMessages, setDeleteMessages
public static final long DEFAULT_POLLING_FREQUENCY
public void setPollingInterval(long pollingInterval)
protected void waitForNewMessages(javax.mail.Folder folder) throws javax.mail.MessagingException, InterruptedException
AbstractMonitoringStrategy
Thread.sleep(long)
or the IMAP IDLE command.waitForNewMessages
in class AbstractMonitoringStrategy
folder
- the folder to monitorjavax.mail.MessagingException
- in case of JavaMail errorsInterruptedException
- when a thread is interruptedprotected void afterSleep(javax.mail.Folder folder) throws javax.mail.MessagingException
Thread.sleep(long)
method has been invoked. This implementation calls Folder.getMessageCount()
, to force new messages to be seen.folder
- the folder to check for new messagesjavax.mail.MessagingException
- in case of JavaMail errorsCopyright © 2019 Pivotal Software. All rights reserved.