Class StandardRotationPolicy
java.lang.Object
org.springframework.integration.file.remote.aop.StandardRotationPolicy
- All Implemented Interfaces:
RotationPolicy
public class StandardRotationPolicy extends java.lang.Object implements RotationPolicy
Standard rotation policy; iterates over key/directory pairs; when the end is reached,
starts again at the beginning. If the fair option is true the rotation occurs on every
poll, regardless of result. Otherwise rotation occurs when the current pair returns no
message.
Subclasses implement
onRotation(MessageSource<?> source) to configure the
MessageSource on each rotation.- Since:
- 5.2
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.file.remote.aop.RotationPolicy
RotationPolicy.KeyDirectory -
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.logging.Loglogger -
Constructor Summary
Constructors Constructor Description StandardRotationPolicy(DelegatingSessionFactory<?> factory, java.util.List<RotationPolicy.KeyDirectory> keyDirectories, boolean fair) -
Method Summary
Modifier and Type Method Description voidafterReceive(boolean messageReceived, org.springframework.integration.core.MessageSource<?> source)Invoked after the message source receive() method.voidbeforeReceive(org.springframework.integration.core.MessageSource<?> source)Invoked before the message source receive() method.protected voidconfigureSource(org.springframework.integration.core.MessageSource<?> source)RotationPolicy.KeyDirectorygetCurrent()Return the currentRotationPolicy.KeyDirectory.protected DelegatingSessionFactory<?>getFactory()protected java.util.Iterator<RotationPolicy.KeyDirectory>getIterator()protected java.util.List<RotationPolicy.KeyDirectory>getKeyDirectories()protected booleanisFair()protected booleanisInitialized()protected voidonRotation(org.springframework.integration.core.MessageSource<?> source)Update the state of theMessageSourceafter the server is rotated, if necessary.
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger
-
-
Constructor Details
-
StandardRotationPolicy
public StandardRotationPolicy(DelegatingSessionFactory<?> factory, java.util.List<RotationPolicy.KeyDirectory> keyDirectories, boolean fair)
-
-
Method Details
-
beforeReceive
public void beforeReceive(org.springframework.integration.core.MessageSource<?> source)Description copied from interface:RotationPolicyInvoked before the message source receive() method.- Specified by:
beforeReceivein interfaceRotationPolicy- Parameters:
source- the message source.
-
afterReceive
public void afterReceive(boolean messageReceived, org.springframework.integration.core.MessageSource<?> source)Description copied from interface:RotationPolicyInvoked after the message source receive() method.- Specified by:
afterReceivein interfaceRotationPolicy- Parameters:
messageReceived- true if a message was received.source- the message source.
-
getCurrent
Description copied from interface:RotationPolicyReturn the currentRotationPolicy.KeyDirectory.- Specified by:
getCurrentin interfaceRotationPolicy- Returns:
- the current
RotationPolicy.KeyDirectory
-
getFactory
-
getKeyDirectories
-
isFair
protected boolean isFair() -
getIterator
-
isInitialized
protected boolean isInitialized() -
configureSource
protected void configureSource(org.springframework.integration.core.MessageSource<?> source) -
onRotation
protected void onRotation(org.springframework.integration.core.MessageSource<?> source)Update the state of theMessageSourceafter the server is rotated, if necessary. The default implementation updates the remote directory for known MessageSource implementations that require it, specifically, instances ofAbstractRemoteFileStreamingMessageSource, andAbstractInboundFileSynchronizingMessageSource, and does nothing otherwise. Subclasses may override this method to support other MessageSource types.- Parameters:
source- the MessageSource.
-