Repository: activemq Updated Branches: refs/heads/activemq-5.13.x 2f935a260 -> 9d545cf11
https://issues.apache.org/jira/browse/AMQ-6222 Reverting the change to move clearMarshalledState into the callback listener as beforeMarshall is now called before the async message add Revert 7f5c09f2d77c77f87a47fb738870c5ee5bc78c27 Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/9d545cf1 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/9d545cf1 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/9d545cf1 Branch: refs/heads/activemq-5.13.x Commit: 9d545cf11f2ed999d68da7b5a16e46adee095a08 Parents: 2f935a2 Author: Christopher L. Shannon (cshannon) <christopher.l.shan...@gmail.com> Authored: Mon Apr 18 11:54:38 2016 +0000 Committer: Christopher L. Shannon (cshannon) <christopher.l.shan...@gmail.com> Committed: Mon Apr 18 11:54:38 2016 +0000 ---------------------------------------------------------------------- .../apache/activemq/broker/region/Queue.java | 24 ++++---------------- 1 file changed, 5 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/9d545cf1/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java ---------------------------------------------------------------------- diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java index 9540a93..8e2943a 100755 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java @@ -840,28 +840,14 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index //condition if the original add is processed after the update, which can cause //a duplicate message to be stored if (messages.isCacheEnabled() && !isPersistJMSRedelivered()) { - message.beforeMarshall(null); + message.beforeMarshall(null); result = store.asyncAddQueueMessage(context, message, isOptimizeStorage()); - final PendingMarshalUsageTracker tracker = new PendingMarshalUsageTracker(message); - result.addListener(new Runnable() { - @Override - public void run() { - //Execute usage tracker and then check isReduceMemoryFootprint() - tracker.run(); - if (isReduceMemoryFootprint()) { - try { - message.clearMarshalledState(); - } catch (JMSException e) { - throw new IllegalStateException(e); - } - } - } - }); + result.addListener(new PendingMarshalUsageTracker(message)); } else { store.addMessage(context, message); - if (isReduceMemoryFootprint()) { - message.clearMarshalledState(); - } + } + if (isReduceMemoryFootprint()) { + message.clearMarshalledState(); } } catch (Exception e) { // we may have a store in inconsistent state, so reset the cursor