diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java index bc7ef3ae94..fb002fe735 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java @@ -147,7 +147,7 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageH } public AbstractCorrelatingMessageHandler(MessageGroupProcessor processor) { - this(processor, SimpleMessageStore.fastMessageStore(0), null, null); + this(processor, new SimpleMessageStore(0), null, null); } public void setLockRegistry(LockRegistry lockRegistry) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageStore.java b/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageStore.java index 433a0f750d..f6a8158e1a 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageStore.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageStore.java @@ -57,7 +57,7 @@ public class SimpleMessageStore extends AbstractMessageGroupStore private volatile boolean isUsed; - private volatile boolean copyOnGet = true; // TODO: default false in 4.1 + private volatile boolean copyOnGet = false; /** * Creates a SimpleMessageStore with a maximum size limited by the given capacity, or unlimited size if the given @@ -113,7 +113,9 @@ public class SimpleMessageStore extends AbstractMessageGroupStore * @param capacity the capacity (0 for unlimited). * @return the store. * @since 4.0.1 + * @deprecated in 4.1 - copyOnGet is now false by default. */ + @Deprecated public static SimpleMessageStore fastMessageStore(int capacity) { SimpleMessageStore store = new SimpleMessageStore(capacity); store.setCopyOnGet(false); @@ -122,6 +124,7 @@ public class SimpleMessageStore extends AbstractMessageGroupStore /** * Set to false to disable copying the group in {@link #getMessageGroup(Object)}. + * Starting with 4.1, this is false by default. * @param copyOnGet True to copy, false to not. * @since 4.0.1 */ diff --git a/src/reference/docbook/message-store.xml b/src/reference/docbook/message-store.xml index 8f946fda88..f8a2e6a9ff 100644 --- a/src/reference/docbook/message-store.xml +++ b/src/reference/docbook/message-store.xml @@ -107,4 +107,22 @@ + + Caution with SimpleMessageStore + + Starting with version 4.1, the SimpleMessageStore no longer copies + the message group when calling getMessageGroup(). For large message groups, this was a significant + performance problem. 4.0.1 introduced a boolean copyOnGet allowing this to be controlled. When + used internally by the aggregator, this was set to false to improve performance. It is now false by default. + + + Users accessing the group store outside of components such as aggregators, will now get a direct reference + to the group being used by the aggregator, instead of a copy. Manipulation of the group outside of the aggregator may + cause unpredictable results. + + + For this reason, users should not perform such manipulation, or set the copyOnGet + property to true. + + diff --git a/src/reference/docbook/whats-new.xml b/src/reference/docbook/whats-new.xml index 27b926935b..3621d4d8f1 100644 --- a/src/reference/docbook/whats-new.xml +++ b/src/reference/docbook/whats-new.xml @@ -11,7 +11,7 @@
General Changes -
+
AMQP Outbound Endpoints The AMQP outbound endpoints support a new property lazy-connect @@ -22,5 +22,13 @@ See for more information.
+
+ SimpleMessageStore + + The SimpleMessageStore no longer makes a copy of the group + when calling getMessageGroup(). + See for more information. + +