activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [2/2] activemq-artemis git commit: Improving bodyBuffer encode / decode
Date Thu, 28 Jan 2016 03:04:49 GMT
Improving bodyBuffer encode / decode


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

Branch: refs/heads/master
Commit: f149e76b3fd6589bb3fbe3df7f1e0f3a0e5cc69b
Parents: a5aa446
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Wed Jan 27 21:31:01 2016 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Jan 27 21:57:00 2016 -0500

----------------------------------------------------------------------
 .../artemis/core/message/impl/MessageImpl.java         | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f149e76b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java
index 7583ce2..df77132 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java
@@ -279,8 +279,8 @@ public abstract class MessageImpl implements MessageInternal {
 
       ByteBuf byteBuf = ChannelBufferWrapper.unwrap(getBodyBuffer().byteBuf());
       byteBuf = byteBuf.duplicate();
-      byteBuf.writerIndex(getBodyBuffer().writerIndex());
       byteBuf.readerIndex(getBodyBuffer().readerIndex());
+      byteBuf.writerIndex(getBodyBuffer().writerIndex());
 
       return new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, byteBuf, null);
    }
@@ -439,6 +439,17 @@ public abstract class MessageImpl implements MessageInternal {
       this.buffer = buffer;
 
       decode();
+
+      // Setting up the BodyBuffer based on endOfBodyPosition set from decode
+      ResetLimitWrappedActiveMQBuffer tmpbodyBuffer = new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET,
buffer, null);
+      tmpbodyBuffer.readerIndex(BODY_OFFSET);
+      tmpbodyBuffer.writerIndex(endOfBodyPosition);
+      // only set this after the writer and reader is set,
+      // otherwise the buffer would be reset through the listener
+      tmpbodyBuffer.setMessage(this);
+      this.bodyBuffer = tmpbodyBuffer;
+
+
    }
 
    @Override


Mime
View raw message