Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7A487200C3C for ; Mon, 3 Apr 2017 13:59:20 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 78CF8160B9F; Mon, 3 Apr 2017 11:59:20 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 99133160B8F for ; Mon, 3 Apr 2017 13:59:19 +0200 (CEST) Received: (qmail 93006 invoked by uid 500); 3 Apr 2017 11:59:18 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 92964 invoked by uid 99); 3 Apr 2017 11:59:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Apr 2017 11:59:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9F221DFE61; Mon, 3 Apr 2017 11:59:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: martyntaylor@apache.org To: commits@activemq.apache.org Date: Mon, 03 Apr 2017 11:59:19 -0000 Message-Id: <902d71f7c5cd440bb461840cdbb0556c@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/3] activemq-artemis git commit: ARTEMIS-1056 Improving allocations on InVM Transport archived-at: Mon, 03 Apr 2017 11:59:20 -0000 ARTEMIS-1056 Improving allocations on InVM Transport Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/b819026d Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/b819026d Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/b819026d Branch: refs/heads/1.x Commit: b819026dfcdcd4a1228774ba87dcae2e94b13a9b Parents: c2989e1 Author: Clebert Suconic Authored: Mon Mar 27 09:40:11 2017 -0400 Committer: Martyn Taylor Committed: Mon Apr 3 12:58:13 2017 +0100 ---------------------------------------------------------------------- .../artemis/core/protocol/core/Packet.java | 9 ------- .../core/impl/ActiveMQSessionContext.java | 2 -- .../core/protocol/core/impl/ChannelImpl.java | 6 ----- .../core/protocol/core/impl/PacketImpl.java | 8 +----- .../wireformat/SessionContinuationMessage.java | 10 ++++---- .../impl/wireformat/SessionReceiveMessage.java | 2 +- .../impl/wireformat/SessionSendMessage.java | 2 +- .../remoting/impl/netty/NettyConnection.java | 5 ---- .../protocol/AbstractRemotingConnection.java | 5 ---- .../spi/core/protocol/RemotingConnection.java | 2 -- .../artemis/spi/core/remoting/Connection.java | 2 -- .../core/protocol/mqtt/MQTTConnection.java | 5 ---- .../core/protocol/stomp/StompConnection.java | 5 ---- .../core/impl/wireformat/QuorumVoteMessage.java | 10 +++----- .../impl/wireformat/QuorumVoteReplyMessage.java | 4 ++- .../core/remoting/impl/invm/InVMConnection.java | 26 ++++---------------- 16 files changed, 19 insertions(+), 84 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/Packet.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/Packet.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/Packet.java index d7ae5b3..ddb734e 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/Packet.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/Packet.java @@ -64,15 +64,6 @@ public interface Packet { ActiveMQBuffer encode(RemotingConnection connection); /** - * Encodes the packet and returns a {@link ActiveMQBuffer} containing the data - * - * @param connection the connection - * @param usePooled if the returned buffer should be pooled or unpooled - * @return the buffer to encode to - */ - ActiveMQBuffer encode(RemotingConnection connection, boolean usePooled); - - /** * decodes the buffer into this packet * * @param buffer the buffer to decode from http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java index b6c0793..56c7135 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java @@ -877,8 +877,6 @@ public class ActiveMQSessionContext extends SessionContext { ActiveMQBuffer buffer = packet.encode(this.getCoreConnection()); conn.write(buffer, false, false); - - buffer.release(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java index bf4dd18..6e5f027 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java @@ -300,9 +300,6 @@ public final class ChannelImpl implements Channel { // The actual send must be outside the lock, or with OIO transport, the write can block if the tcp // buffer is full, preventing any incoming buffers being handled and blocking failover connection.getTransportConnection().write(buffer, flush, batch); - - buffer.release(); - return true; } } @@ -410,7 +407,6 @@ public final class ChannelImpl implements Channel { } } finally { lock.unlock(); - buffer.release(); } return response; @@ -634,8 +630,6 @@ public final class ChannelImpl implements Channel { connection.getTransportConnection().write(buffer, false, false); - buffer.release(); - } private void addResendPacket(Packet packet) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java index d373176..6dddf3b 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java @@ -274,13 +274,7 @@ public class PacketImpl implements Packet { @Override public ActiveMQBuffer encode(final RemotingConnection connection) { - return encode(connection,true); - } - - - @Override - public ActiveMQBuffer encode(final RemotingConnection connection, boolean usePooled) { - ActiveMQBuffer buffer = connection.createTransportBuffer(PacketImpl.INITIAL_PACKET_SIZE, usePooled); + ActiveMQBuffer buffer = connection.createTransportBuffer(PacketImpl.INITIAL_PACKET_SIZE); // The standard header fields http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionContinuationMessage.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionContinuationMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionContinuationMessage.java index faeed08..40d3622 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionContinuationMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionContinuationMessage.java @@ -79,8 +79,8 @@ public abstract class SessionContinuationMessage extends PacketImpl { } @Override - public final ActiveMQBuffer encode(final RemotingConnection connection, boolean usePooled) { - final ActiveMQBuffer buffer = createPacket(connection, usePooled); + public final ActiveMQBuffer encode(final RemotingConnection connection) { + final ActiveMQBuffer buffer = createPacket(connection); // The standard header fields @@ -100,12 +100,12 @@ public abstract class SessionContinuationMessage extends PacketImpl { return buffer; } - protected final ActiveMQBuffer createPacket(RemotingConnection connection, boolean usePooled) { + protected final ActiveMQBuffer createPacket(RemotingConnection connection) { final int expectedEncodedSize = expectedEncodedSize(); if (connection == null) { return new ChannelBufferWrapper(Unpooled.buffer(expectedEncodedSize)); } else { - return connection.createTransportBuffer(expectedEncodedSize, usePooled); + return connection.createTransportBuffer(expectedEncodedSize); } } @@ -158,4 +158,4 @@ public abstract class SessionContinuationMessage extends PacketImpl { return true; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionReceiveMessage.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionReceiveMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionReceiveMessage.java index c21ebda..2129b49 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionReceiveMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionReceiveMessage.java @@ -56,7 +56,7 @@ public class SessionReceiveMessage extends MessagePacket { public ActiveMQBuffer encode(final RemotingConnection connection) { ActiveMQBuffer buffer = message.getEncodedBuffer(); - ActiveMQBuffer bufferWrite = connection.createTransportBuffer(buffer.writerIndex() + DataConstants.SIZE_LONG + DataConstants.SIZE_INT, true); + ActiveMQBuffer bufferWrite = connection.createTransportBuffer(buffer.writerIndex() + DataConstants.SIZE_LONG + DataConstants.SIZE_INT); bufferWrite.writeBytes(buffer, 0, buffer.capacity()); bufferWrite.setIndex(buffer.readerIndex(), buffer.writerIndex()); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionSendMessage.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionSendMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionSendMessage.java index c7bb30e..91d43a5 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionSendMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionSendMessage.java @@ -68,7 +68,7 @@ public class SessionSendMessage extends MessagePacket { // this is for unit tests only bufferWrite = buffer.copy(0, buffer.capacity()); } else { - bufferWrite = connection.createTransportBuffer(buffer.writerIndex() + 1, true); // 1 for the requireResponse + bufferWrite = connection.createTransportBuffer(buffer.writerIndex() + 1); // 1 for the requireResponse } bufferWrite.writeBytes(buffer, 0, buffer.writerIndex()); bufferWrite.setIndex(buffer.readerIndex(), buffer.writerIndex()); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java index c3a71c5..679844a 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java @@ -211,11 +211,6 @@ public class NettyConnection implements Connection { @Override public ActiveMQBuffer createTransportBuffer(final int size) { - return createTransportBuffer(size, false); - } - - @Override - public ActiveMQBuffer createTransportBuffer(final int size, boolean pooled) { return new ChannelBufferWrapper(PooledByteBufAllocator.DEFAULT.directBuffer(size), true); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java index 6884243..a9e12aa 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java @@ -179,11 +179,6 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { } @Override - public ActiveMQBuffer createTransportBuffer(final int size, boolean pooled) { - return transportConnection.createTransportBuffer(size, pooled); - } - - @Override public Connection getTransportConnection() { return transportConnection; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java index a68999b..39ecdf6 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java @@ -120,8 +120,6 @@ public interface RemotingConnection extends BufferHandler { */ ActiveMQBuffer createTransportBuffer(int size); - ActiveMQBuffer createTransportBuffer(int size, boolean pooled); - /** * called when the underlying connection fails. * http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java index a5fcf87..7ab0c40 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java @@ -35,8 +35,6 @@ public interface Connection { */ ActiveMQBuffer createTransportBuffer(int size); - ActiveMQBuffer createTransportBuffer(int size, boolean pooled); - RemotingConnection getProtocolConnection(); void setProtocolConnection(RemotingConnection connection); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java index 6143cf7..446e362 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java @@ -132,11 +132,6 @@ public class MQTTConnection implements RemotingConnection { @Override public ActiveMQBuffer createTransportBuffer(int size) { - return createTransportBuffer(size, false); - } - - @Override - public ActiveMQBuffer createTransportBuffer(int size, boolean pooled) { return transportConnection.createTransportBuffer(size); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java index 899ffde..c046b26 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java @@ -269,11 +269,6 @@ public final class StompConnection implements RemotingConnection { @Override public ActiveMQBuffer createTransportBuffer(int size) { - return createTransportBuffer(size, false); - } - - @Override - public ActiveMQBuffer createTransportBuffer(int size, boolean pooled) { return ActiveMQBuffers.dynamicBuffer(size); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteMessage.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteMessage.java index 78ebcb9..5c030ae 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteMessage.java @@ -17,11 +17,11 @@ package org.apache.activemq.artemis.core.protocol.core.impl.wireformat; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.ActiveMQBuffers; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteHandler; import org.apache.activemq.artemis.core.server.cluster.qourum.Vote; -import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; public class QuorumVoteMessage extends PacketImpl { @@ -42,11 +42,6 @@ public class QuorumVoteMessage extends PacketImpl { } @Override - public ActiveMQBuffer encode(final RemotingConnection connection) { - return encode(connection,false); - } - - @Override public void encodeRest(ActiveMQBuffer buffer) { super.encodeRest(buffer); buffer.writeSimpleString(handler); @@ -57,7 +52,8 @@ public class QuorumVoteMessage extends PacketImpl { public void decodeRest(ActiveMQBuffer buffer) { super.decodeRest(buffer); handler = buffer.readSimpleString(); - voteBuffer = buffer.readSlice(buffer.readableBytes()); + voteBuffer = ActiveMQBuffers.fixedBuffer(buffer.readableBytes()); + buffer.readBytes(voteBuffer); } public SimpleString getHandler() { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteReplyMessage.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteReplyMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteReplyMessage.java index ff0609c..8a4f091 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteReplyMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteReplyMessage.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.core.protocol.core.impl.wireformat; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.ActiveMQBuffers; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteHandler; @@ -62,7 +63,8 @@ public class QuorumVoteReplyMessage extends PacketImpl { public void decodeRest(ActiveMQBuffer buffer) { super.decodeRest(buffer); handler = buffer.readSimpleString(); - voteBuffer = buffer.readSlice(buffer.readableBytes()); + voteBuffer = ActiveMQBuffers.fixedBuffer(buffer.readableBytes()); + buffer.readBytes(voteBuffer); } public void decodeRest(QuorumVoteHandler voteHandler) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b819026d/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java index 1bd1bac..33da5f7 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java @@ -152,15 +152,10 @@ public class InVMConnection implements Connection { @Override public ActiveMQBuffer createTransportBuffer(final int size) { - return createTransportBuffer(size, false); - } - - @Override - public ActiveMQBuffer createTransportBuffer(final int size, boolean pooled) { - if (bufferPoolingEnabled && pooled) { + if (bufferPoolingEnabled) { return ActiveMQBuffers.pooledBuffer( size ); } - return ActiveMQBuffers.dynamicBuffer( size ); + return ActiveMQBuffers.dynamicBuffer(size); } @Override @@ -188,26 +183,18 @@ public class InVMConnection implements Connection { final boolean batch, final ChannelFutureListener futureListener) { - final ActiveMQBuffer copied = ActiveMQBuffers.pooledBuffer(buffer.capacity()); - int read = buffer.readerIndex(); - int writ = buffer.writerIndex(); - copied.writeBytes(buffer,read,writ - read); - copied.setIndex(read,writ); - buffer.setIndex(read,writ); - try { executor.execute(new Runnable() { @Override public void run() { try { if (!closed) { - copied.readInt(); // read and discard + buffer.readInt(); // read and discard if (logger.isTraceEnabled()) { logger.trace(InVMConnection.this + "::Sending inVM packet"); } - handler.bufferReceived(id, copied); + handler.bufferReceived(id, buffer); if (futureListener != null) { - // TODO BEFORE MERGE: (is null a good option here?) futureListener.operationComplete(null); } } @@ -216,13 +203,10 @@ public class InVMConnection implements Connection { ActiveMQServerLogger.LOGGER.errorWritingToInvmConnector(e, this); throw new IllegalStateException(msg, e); } finally { + buffer.release(); if (logger.isTraceEnabled()) { logger.trace(InVMConnection.this + "::packet sent done"); } - copied.release(); -// if ( copied.byteBuf().refCnt() > 0 ) { -// copied.release(); -// } } } });