You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/01/28 04:04:49 UTC
[2/2] activemq-artemis git commit: Improving bodyBuffer encode /
decode
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 <cl...@apache.org>
Authored: Wed Jan 27 21:31:01 2016 -0500
Committer: Clebert Suconic <cl...@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