INT-3416 Reset SMS.copyOnGet By Default
JIRA: https://jira.spring.io/browse/INT-3416 Add caution to docs about users getting a hard reference to the group instead of a copy.
This commit is contained in:
committed by
Artem Bilan
parent
1df6d872fa
commit
117669fb9a
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -107,4 +107,22 @@
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<caution id="sms-caution">
|
||||
<title>Caution with SimpleMessageStore</title>
|
||||
<para>
|
||||
Starting with <emphasis>version 4.1</emphasis>, the <classname>SimpleMessageStore</classname> no longer copies
|
||||
the message group when calling <code>getMessageGroup()</code>. For large message groups, this was a significant
|
||||
performance problem. 4.0.1 introduced a boolean <code>copyOnGet</code> 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.
|
||||
</para>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
<para>
|
||||
For this reason, users should not perform such manipulation, or set the <code>copyOnGet</code>
|
||||
property to <code>true</code>.
|
||||
</para>
|
||||
</caution>
|
||||
</section>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</para>
|
||||
<section id="4.1-general">
|
||||
<title>General Changes</title>
|
||||
<section>
|
||||
<section id="4.1-amqp-outbound-lazy-connect">
|
||||
<title>AMQP Outbound Endpoints</title>
|
||||
<para>
|
||||
The AMQP outbound endpoints support a new property <code>lazy-connect</code>
|
||||
@@ -22,5 +22,13 @@
|
||||
See <xref linkend="amqp"/> for more information.
|
||||
</para>
|
||||
</section>
|
||||
<section id="4.1-sms-copy-on-get">
|
||||
<title>SimpleMessageStore</title>
|
||||
<para>
|
||||
The <classname>SimpleMessageStore</classname> no longer makes a copy of the group
|
||||
when calling <code>getMessageGroup()</code>.
|
||||
See <xref linkend="sms-caution"/> for more information.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
</chapter>
|
||||
|
||||
Reference in New Issue
Block a user