activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [2/2] activemq-artemis git commit: ARTEMIS-1077 Fixing Pool usage on InVM and RemotingConnection
Date Tue, 28 Mar 2017 14:26:42 GMT
ARTEMIS-1077 Fixing Pool usage on InVM and RemotingConnection


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

Branch: refs/heads/master
Commit: b395504e151304bef2a2fa9624f773c8d3e49cb6
Parents: 3efeccf
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Mon Mar 27 11:54:44 2017 -0400
Committer: Justin Bertram <jbertram@apache.org>
Committed: Tue Mar 28 09:19:57 2017 -0500

----------------------------------------------------------------------
 .../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     | 12 +++------
 .../core/impl/wireformat/MessagePacket.java     |  4 +--
 .../wireformat/SessionContinuationMessage.java  |  6 ++---
 .../impl/wireformat/SessionReceiveMessage.java  |  4 +--
 .../impl/wireformat/SessionSendMessage.java     |  6 ++---
 .../remoting/impl/netty/NettyConnection.java    |  8 ++----
 .../remoting/impl/netty/NettyConnector.java     |  4 +--
 .../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 |  6 -----
 .../core/remoting/impl/invm/InVMConnection.java | 28 +++-----------------
 17 files changed, 20 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b395504e/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/b395504e/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 38cc177..6f92330 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
@@ -920,8 +920,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/b395504e/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 e95227d..75c23de 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
@@ -304,9 +304,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;
       }
    }
@@ -415,7 +412,6 @@ public final class ChannelImpl implements Channel {
             }
          } finally {
             lock.unlock();
-            buffer.release();
          }
 
          return response;
@@ -639,8 +635,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/b395504e/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 08c17e4..75f5086 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
@@ -308,13 +308,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 = createPacket(connection, usePooled);
+      ActiveMQBuffer buffer =  createPacket(connection);
 
       // The standard header fields
 
@@ -334,11 +328,11 @@ public class PacketImpl implements Packet {
       return buffer;
    }
 
-   protected ActiveMQBuffer createPacket(RemotingConnection connection, boolean usePooled)
{
+   protected ActiveMQBuffer createPacket(RemotingConnection connection) {
       if (connection == null) {
          return new ChannelBufferWrapper(Unpooled.buffer(INITIAL_PACKET_SIZE));
       } else {
-         return connection.createTransportBuffer(PacketImpl.INITIAL_PACKET_SIZE, usePooled);
+         return connection.createTransportBuffer(PacketImpl.INITIAL_PACKET_SIZE);
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b395504e/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/MessagePacket.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/MessagePacket.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/MessagePacket.java
index 49989d3..0c32007 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/MessagePacket.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/MessagePacket.java
@@ -43,11 +43,11 @@ public abstract class MessagePacket extends PacketImpl implements MessagePacketI
       return super.getParentString() + ", message=" + message;
    }
 
-   protected ActiveMQBuffer internalCreatePacket(int size, RemotingConnection connection,
boolean usePooled) {
+   protected ActiveMQBuffer internalCreatePacket(int size, RemotingConnection connection)
{
       if (connection == null) {
          return new ChannelBufferWrapper(Unpooled.buffer(size));
       } else {
-         return connection.createTransportBuffer(size, usePooled);
+         return connection.createTransportBuffer(size);
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b395504e/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 a57cdb4..d2a4266 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,12 +79,12 @@ public abstract class SessionContinuationMessage extends PacketImpl {
    }
 
    @Override
-   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);
       }
    }
 
@@ -137,4 +137,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/b395504e/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 b0ab52b..d89e394 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
@@ -54,8 +54,8 @@ public class SessionReceiveMessage extends MessagePacket {
    }
 
    @Override
-   protected ActiveMQBuffer createPacket(RemotingConnection connection, boolean usePooled)
{
-      return internalCreatePacket(message.getEncodeSize() + PACKET_HEADERS_SIZE + DataConstants.SIZE_LONG
+ DataConstants.SIZE_INT, connection, usePooled);
+   protected ActiveMQBuffer createPacket(RemotingConnection connection) {
+      return internalCreatePacket(message.getEncodeSize() + PACKET_HEADERS_SIZE + DataConstants.SIZE_LONG
+ DataConstants.SIZE_INT, connection);
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b395504e/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 43bb0be..79cb4cb 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
@@ -62,16 +62,14 @@ public class SessionSendMessage extends MessagePacket {
    }
 
    @Override
-   protected ActiveMQBuffer createPacket(RemotingConnection connection, boolean usePooled)
{
-      return internalCreatePacket(message.getEncodeSize() + PACKET_HEADERS_SIZE + 1, connection,
usePooled);
+   protected ActiveMQBuffer createPacket(RemotingConnection connection) {
+      return internalCreatePacket(message.getEncodeSize() + PACKET_HEADERS_SIZE + 1, connection);
    }
 
    @Override
    public void encodeRest(ActiveMQBuffer buffer) {
       message.sendBuffer(buffer.byteBuf(), 0);
       buffer.writeBoolean(requiresResponse);
-
-
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b395504e/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 2355439..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
@@ -23,6 +23,7 @@ import java.util.Map;
 import java.util.concurrent.Semaphore;
 
 import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelFutureListener;
@@ -210,12 +211,7 @@ 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(channel.alloc().directBuffer(size), true);
+      return new ChannelBufferWrapper(PooledByteBufAllocator.DEFAULT.directBuffer(size),
true);
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b395504e/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java
index 4997e0f..31367c8 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java
@@ -393,7 +393,7 @@ public class NettyConnector extends AbstractConnector {
          }
 
          channelClazz = EpollSocketChannel.class;
-         logger.info("Connector " + this + " using native epoll");
+         logger.debug("Connector " + this + " using native epoll");
       } else {
          if (useGlobalWorkerPool) {
             channelClazz = NioSocketChannel.class;
@@ -404,7 +404,7 @@ public class NettyConnector extends AbstractConnector {
          }
 
          channelClazz = NioSocketChannel.class;
-         logger.info("Connector + " + this + " using nio");
+         logger.debug("Connector + " + this + " using nio");
       }
       // if we are a servlet wrap the socketChannelFactory
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b395504e/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/b395504e/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/b395504e/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/b395504e/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/b395504e/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 56067f1..a10f2e0 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
@@ -297,11 +297,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/b395504e/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 435514b..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
@@ -22,7 +22,6 @@ 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 {
 
@@ -43,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);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b395504e/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 24931d3..f49aade 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
@@ -146,16 +146,7 @@ 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 ( pooled ) {
-         return ActiveMQBuffers.pooledBuffer( size );
-      } else {
-         return ActiveMQBuffers.dynamicBuffer( size );
-      }
+      return ActiveMQBuffers.pooledBuffer(size);
    }
 
    @Override
@@ -183,26 +174,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);
                      }
                   }
@@ -211,13 +194,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();
-//                  }
                }
             }
          });


Mime
View raw message