Class PollingMonitoringStrategy
java.lang.Object
org.springframework.ws.transport.mail.monitor.AbstractMonitoringStrategy
org.springframework.ws.transport.mail.monitor.PollingMonitoringStrategy
- All Implemented Interfaces:
MonitoringStrategy
- Direct Known Subclasses:
Pop3PollingMonitoringStrategy
Implementation of the
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.
- Since:
- 1.5.0
- Author:
- Arjen Poutsma
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
Defines the default polling frequency.Fields inherited from class org.springframework.ws.transport.mail.monitor.AbstractMonitoringStrategy
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
afterSleep
(jakarta.mail.Folder folder) Invoked after theThread.sleep(long)
method has been invoked.void
setPollingInterval
(long pollingInterval) Sets the interval used in between message polls, in milliseconds.protected void
waitForNewMessages
(jakarta.mail.Folder folder) Template method that blocks until new messages arrive in the given folder.Methods inherited from class org.springframework.ws.transport.mail.monitor.AbstractMonitoringStrategy
deleteMessages, fetchMessages, getFolderOpenMode, monitor, searchForNewMessages, setDeleteMessages
-
Field Details
-
DEFAULT_POLLING_FREQUENCY
public static final long DEFAULT_POLLING_FREQUENCYDefines the default polling frequency. Set to 1000 * 60 milliseconds (i.e. 1 minute).- See Also:
-
-
Constructor Details
-
PollingMonitoringStrategy
public PollingMonitoringStrategy()
-
-
Method Details
-
setPollingInterval
public void setPollingInterval(long pollingInterval) Sets the interval used in between message polls, in milliseconds. The default is 1000 * 60 ms, that is 1 minute. -
waitForNewMessages
protected void waitForNewMessages(jakarta.mail.Folder folder) throws jakarta.mail.MessagingException, InterruptedException Description copied from class:AbstractMonitoringStrategy
Template method that blocks until new messages arrive in the given folder. Typical implementations useThread.sleep(long)
or the IMAP IDLE command.- Specified by:
waitForNewMessages
in classAbstractMonitoringStrategy
- Parameters:
folder
- the folder to monitor- Throws:
jakarta.mail.MessagingException
- in case of JavaMail errorsInterruptedException
- when a thread is interrupted
-
afterSleep
protected void afterSleep(jakarta.mail.Folder folder) throws jakarta.mail.MessagingException Invoked after theThread.sleep(long)
method has been invoked. This implementation callsFolder.getMessageCount()
, to force new messages to be seen.- Parameters:
folder
- the folder to check for new messages- Throws:
jakarta.mail.MessagingException
- in case of JavaMail errors
-