From 4d239ac80355a9eabec99683b11e1c6c308e39c8 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 26 Jan 2016 22:30:24 -0500 Subject: [PATCH] ARTEMIS-357 fixing issue with Messages Growing after JMS sends (after my last change on ARTEMIS-357) --- .../core/buffers/impl/ResetLimitWrappedActiveMQBuffer.java | 4 ++-- .../activemq/artemis/core/client/impl/ClientMessageImpl.java | 2 +- .../activemq/artemis/core/message/impl/MessageImpl.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/buffers/impl/ResetLimitWrappedActiveMQBuffer.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/buffers/impl/ResetLimitWrappedActiveMQBuffer.java index b3cdfe193b..61ecef613b 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/buffers/impl/ResetLimitWrappedActiveMQBuffer.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/buffers/impl/ResetLimitWrappedActiveMQBuffer.java @@ -45,7 +45,7 @@ public final class ResetLimitWrappedActiveMQBuffer extends ChannelBufferWrapper public ResetLimitWrappedActiveMQBuffer(final int limit, final ActiveMQBuffer buffer, final MessageInternal message) { // a wrapped inside a wrapper will increase the stack size. // we fixed this here due to some profiling testing - super(unwrap(buffer.byteBuf())); + super(unwrap(buffer.byteBuf()).duplicate()); this.limit = limit; @@ -53,7 +53,7 @@ public final class ResetLimitWrappedActiveMQBuffer extends ChannelBufferWrapper writerIndex(limit); } - buffer.readerIndex(limit); + readerIndex(limit); this.message = message; } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java index 7668251842..31d9aad389 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java @@ -136,7 +136,7 @@ public class ClientMessageImpl extends MessageImpl implements ClientMessageInter @Override public int getBodySize() { - return buffer.writerIndex() - buffer.readerIndex(); + return getBodyBuffer().writerIndex() - getBodyBuffer().readerIndex(); } @Override 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 e7c33ffd7d..ca526211b8 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 @@ -448,7 +448,7 @@ public abstract class MessageImpl implements MessageInternal { @Override public int getEndOfBodyPosition() { if (endOfBodyPosition < 0) { - endOfBodyPosition = buffer.writerIndex(); + endOfBodyPosition = getBodyBuffer().writerIndex(); } return endOfBodyPosition; }