org.springframework.ws.transport.mail.monitor
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
public class PollingMonitoringStrategy
- extends AbstractMonitoringStrategy
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
|
Method Summary |
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_POLLING_FREQUENCY
public static final long DEFAULT_POLLING_FREQUENCY
- Defines the default polling frequency. Set to 1000 * 60 milliseconds (i.e. 1 minute).
- See Also:
- Constant Field Values
PollingMonitoringStrategy
public PollingMonitoringStrategy()
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(javax.mail.Folder folder)
throws javax.mail.MessagingException,
InterruptedException
- Description copied from class:
AbstractMonitoringStrategy
- Template method that blocks until new messages arrive in the given folder. Typical implementations use
Thread.sleep(long) or the IMAP IDLE command.
- Specified by:
waitForNewMessages in class AbstractMonitoringStrategy
- Parameters:
folder - the folder to monitor
- Throws:
javax.mail.MessagingException - in case of JavaMail errors
InterruptedException - when a thread is interrupted
afterSleep
protected void afterSleep(javax.mail.Folder folder)
throws javax.mail.MessagingException
- Invoked after the
Thread.sleep(long) method has been invoked. This implementation calls Folder.getMessageCount(), to force new messages to be seen.
- Parameters:
folder - the folder to check for new messages
- Throws:
javax.mail.MessagingException - in case of JavaMail errors
Copyright © 2012 The Spring Web Services Framework. All Rights Reserved.