mirror of https://github.com/apache/activemq.git
Moving the bytes copy to the parent Message class to solve this this issue for all message types as that is the root cause
This commit is contained in:
parent
837da7e582
commit
e69c2cbad6
|
@ -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());
|
||||
|
|
|
@ -143,8 +143,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;
|
||||
|
@ -165,6 +165,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) {
|
||||
|
|
Loading…
Reference in New Issue