public class StandardRotationPolicy extends Object implements RotationPolicy
onRotation(MessageSource<?> source)
to configure the
MessageSource
on each rotation.RotationPolicy.KeyDirectory
Constructor and Description |
---|
StandardRotationPolicy(DelegatingSessionFactory<?> factory,
List<RotationPolicy.KeyDirectory> keyDirectories,
boolean fair) |
Modifier and Type | Method and Description |
---|---|
void |
afterReceive(boolean messageReceived,
MessageSource<?> source)
Invoked after the message source receive() method.
|
void |
beforeReceive(MessageSource<?> source)
Invoked before the message source receive() method.
|
protected void |
configureSource(MessageSource<?> source) |
RotationPolicy.KeyDirectory |
getCurrent()
Return the current
RotationPolicy.KeyDirectory . |
protected DelegatingSessionFactory<?> |
getFactory() |
protected Iterator<RotationPolicy.KeyDirectory> |
getIterator() |
protected List<RotationPolicy.KeyDirectory> |
getKeyDirectories() |
protected boolean |
isFair() |
protected boolean |
isInitialized() |
protected void |
onRotation(MessageSource<?> source)
Update the state of the
MessageSource after the server is rotated, if necessary. |
protected final Log logger
public StandardRotationPolicy(DelegatingSessionFactory<?> factory, List<RotationPolicy.KeyDirectory> keyDirectories, boolean fair)
public void beforeReceive(MessageSource<?> source)
RotationPolicy
beforeReceive
in interface RotationPolicy
source
- the message source.public void afterReceive(boolean messageReceived, MessageSource<?> source)
RotationPolicy
afterReceive
in interface RotationPolicy
messageReceived
- true if a message was received.source
- the message source.public RotationPolicy.KeyDirectory getCurrent()
RotationPolicy
RotationPolicy.KeyDirectory
.getCurrent
in interface RotationPolicy
RotationPolicy.KeyDirectory
protected DelegatingSessionFactory<?> getFactory()
protected List<RotationPolicy.KeyDirectory> getKeyDirectories()
protected boolean isFair()
protected Iterator<RotationPolicy.KeyDirectory> getIterator()
protected boolean isInitialized()
protected void configureSource(MessageSource<?> source)
protected void onRotation(MessageSource<?> source)
MessageSource
after the server is rotated, if necessary.
The default implementation updates the remote directory for known MessageSource implementations that require it,
specifically, instances of AbstractRemoteFileStreamingMessageSource
, and
AbstractInboundFileSynchronizingMessageSource
, and does nothing otherwise.
Subclasses may override this method to support other MessageSource types.source
- the MessageSource.