Skip to content

GH-3027: Rotator enhancements 5.1.x #3033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ protected boolean isFair() {
return this.fair;
}

protected KeyDirectory getCurrent() {
public KeyDirectory getCurrent() {
return this.current;
}

Expand Down Expand Up @@ -201,18 +201,27 @@ public void afterReceive(boolean messageReceived, MessageSource<?> source) {
}

protected void configureSource(MessageSource<?> source) {
Assert.isTrue(source instanceof AbstractInboundFileSynchronizingMessageSource
|| source instanceof AbstractRemoteFileStreamingMessageSource,
"source must be an AbstractInboundFileSynchronizingMessageSource or a "
+ "AbstractRemoteFileStreamingMessageSource");
if (!this.iterator.hasNext()) {
this.iterator = this.keyDirectories.iterator();
}
this.current = this.iterator.next();
onRotation(source);
}

/**
* Update the state of the {@link 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 {@link AbstractRemoteFileStreamingMessageSource}, and
* {@link AbstractInboundFileSynchronizingMessageSource}, and does nothing otherwise.
* Subclasses may override this method to support other MessageSource types.
*
* @param source the MessageSource.
*/
protected void onRotation(MessageSource<?> source) {
if (source instanceof AbstractRemoteFileStreamingMessageSource) {
((AbstractRemoteFileStreamingMessageSource<?>) source).setRemoteDirectory(this.current.getDirectory());
}
else {
else if (source instanceof AbstractInboundFileSynchronizingMessageSource) {
((AbstractInboundFileSynchronizingMessageSource<?>) source).getSynchronizer()
.setRemoteDirectory(this.current.getDirectory());
}
Expand Down