activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cshan...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6142
Date Mon, 11 Apr 2016 12:33:13 GMT
Repository: activemq
Updated Branches:
  refs/heads/activemq-5.13.x 078da5e7f -> 20e84d63e


https://issues.apache.org/jira/browse/AMQ-6142

Moving the bytes copy to the parent Message class to solve this this
issue for all message types as that is the root cause

(cherry picked from commit e69c2cbad6611fa355bd9eb592f03bd3b8f90abb)


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/20e84d63
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/20e84d63
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/20e84d63

Branch: refs/heads/activemq-5.13.x
Commit: 20e84d63e045d3d26627e204c808677a8fe77dc4
Parents: 078da5e
Author: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Authored: Mon Apr 11 12:31:57 2016 +0000
Committer: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Committed: Mon Apr 11 12:33:04 2016 +0000

----------------------------------------------------------------------
 .../apache/activemq/command/ActiveMQBytesMessage.java    |  2 --
 .../main/java/org/apache/activemq/command/Message.java   | 11 +++++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/20e84d63/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java
b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java
index 5d618ac..8806028 100755
--- a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java
+++ b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java
@@ -890,8 +890,6 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
         Inflater inflater = new Inflater();
         ByteArrayOutputStream decompressed = new ByteArrayOutputStream();
         try {
-            //copy to prevent a race condition - AMQ-6142
-            dataSequence = new ByteSequence(dataSequence.getData(), dataSequence.getOffset(),
dataSequence.getLength());
             length = ByteSequenceData.readIntBig(dataSequence);
             dataSequence.offset = 0;
             byte[] data = Arrays.copyOfRange(dataSequence.getData(), 4, dataSequence.getLength());

http://git-wip-us.apache.org/repos/asf/activemq/blob/20e84d63/activemq-client/src/main/java/org/apache/activemq/command/Message.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/command/Message.java b/activemq-client/src/main/java/org/apache/activemq/command/Message.java
index 4c57feb..f13db20 100755
--- a/activemq-client/src/main/java/org/apache/activemq/command/Message.java
+++ b/activemq-client/src/main/java/org/apache/activemq/command/Message.java
@@ -142,8 +142,8 @@ public abstract class Message extends BaseCommand implements MarshallAware,
Mess
             copy.properties = properties;
         }
 
-        copy.content = content;
-        copy.marshalledProperties = marshalledProperties;
+        copy.content = copyByteSequence(content);
+        copy.marshalledProperties = copyByteSequence(marshalledProperties);
         copy.dataStructure = dataStructure;
         copy.readOnlyProperties = readOnlyProperties;
         copy.readOnlyBody = readOnlyBody;
@@ -164,6 +164,13 @@ public abstract class Message extends BaseCommand implements MarshallAware,
Mess
         // copy.referenceCount = referenceCount;
     }
 
+    private ByteSequence copyByteSequence(ByteSequence content) {
+        if (content != null) {
+            return new ByteSequence(content.getData(), content.getOffset(), content.getLength());
+        }
+        return null;
+    }
+
     public Object getProperty(String name) throws IOException {
         if (properties == null) {
             if (marshalledProperties == null) {


Mime
View raw message