INT-4294: CorrelatingMHs: Improve JavaDocs

JIRA: https://jira.spring.io/browse/INT-4294

* Clarify the Aggregator and Resequencer behavior in the `afterRelease()`
implementation.
This commit is contained in:
Artem Bilan
2017-11-07 14:29:18 -05:00
committed by Gary Russell
parent 23137fd0cb
commit 37daeae094
3 changed files with 21 additions and 5 deletions

View File

@@ -83,6 +83,7 @@ import org.springframework.util.CollectionUtils;
* @author Artem Bilan
* @author David Liu
* @author Enrique Rodriguez
*
* @since 2.0
*/
public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageProducingHandler
@@ -432,9 +433,9 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageP
completedMessages = this.completeGroup(message, correlationKey, messageGroup);
}
finally {
// Always clean up even if there was an exception
// processing messages
this.afterRelease(messageGroup, completedMessages);
// Possible clean (implementation dependency) up
// even if there was an exception processing messages
afterRelease(messageGroup, completedMessages);
}
if (!isExpireGroupsUponCompletion() && this.minimumTimeoutForEmptyGroups > 0) {
removeEmptyGroupAfterTimeout(messageGroup, this.minimumTimeoutForEmptyGroups);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@ import org.springframework.messaging.Message;
* @author Oleg Zhurakousky
* @author Artem Bilan
* @author Gary Russell
*
* @since 2.1
*/
public class AggregatingMessageHandler extends AbstractCorrelatingMessageHandler {
@@ -66,6 +67,12 @@ public class AggregatingMessageHandler extends AbstractCorrelatingMessageHandler
return this.expireGroupsUponCompletion;
}
/**
* Complete the group and remove all its messages.
* If the {@link #expireGroupsUponCompletion} is true, then remove group fully.
* @param messageGroup the group to clean up.
* @param completedMessages The completed messages. Ignored in this implementation.
*/
@Override
protected void afterRelease(MessageGroup messageGroup, Collection<Message<?>> completedMessages) {
Object groupId = messageGroup.getGroupId();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@ import org.springframework.messaging.Message;
* @author Oleg Zhurakousky
* @author Gary Russell
* @author Artem Bilan
*
* @since 2.1
*/
public class ResequencingMessageHandler extends AbstractCorrelatingMessageHandler {
@@ -75,6 +76,13 @@ public class ResequencingMessageHandler extends AbstractCorrelatingMessageHandle
afterRelease(messageGroup, completedMessages, false);
}
/**
* Perform group removal if its {@code size} is equal to the {@code sequenceSize}.
* Remove {@code completedMessages} from the group if it isn't null.
* @param messageGroup the group to clean up.
* @param completedMessages The completed messages.
* @param timeout True if the release/discard was due to a timeout.
*/
@Override
protected void afterRelease(MessageGroup messageGroup, Collection<Message<?>> completedMessages, boolean timeout) {
int size = messageGroup.size();