Repository: qpid-jms Updated Branches: refs/heads/master b95ac58df -> bfc69cf9d
Use the simple inbound adapter instead of the plain one. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/ab895ca4 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/ab895ca4 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/ab895ca4 Branch: refs/heads/master Commit: ab895ca4c158729cf12c6edbe3aa2d245157cd08 Parents: b95ac58 Author: Timothy Bish <tabish...@gmail.com> Authored: Wed Jan 7 15:12:15 2015 -0500 Committer: Timothy Bish <tabish...@gmail.com> Committed: Wed Jan 7 15:12:15 2015 -0500 ---------------------------------------------------------------------- .../qpid/jms/transports/NettyTcpTransport.java | 22 +++++++------------- 1 file changed, 8 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/ab895ca4/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/NettyTcpTransport.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/NettyTcpTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/NettyTcpTransport.java index ebd385d..fb9629f 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/NettyTcpTransport.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/NettyTcpTransport.java @@ -22,14 +22,13 @@ import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.FixedRecvByteBufAllocator; +import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioSocketChannel; -import io.netty.util.ReferenceCountUtil; import java.io.IOException; import java.net.URI; @@ -165,7 +164,7 @@ public class NettyTcpTransport implements Transport { //----- Handle connection events -----------------------------------------// - private class NettyTcpTransportHandler extends ChannelInboundHandlerAdapter { + private class NettyTcpTransportHandler extends SimpleChannelInboundHandler<ByteBuf> { @Override public void channelActive(ChannelHandlerContext context) throws Exception { @@ -173,17 +172,6 @@ public class NettyTcpTransport implements Transport { } @Override - public void channelRead(ChannelHandlerContext context, Object inbound) throws Exception { - ByteBuf buffer = (ByteBuf) inbound; - LOG.info("New data read: {} bytes incoming", buffer.readableBytes()); - try { - listener.onData(new Buffer(buffer)); - } finally { - ReferenceCountUtil.release(inbound); - } - } - - @Override public void channelInactive(ChannelHandlerContext context) throws Exception { LOG.info("Channel has gone inactive! Channel is {}", context.channel()); if (!closed.get()) { @@ -200,5 +188,11 @@ public class NettyTcpTransport implements Transport { listener.onTransportError(cause); } } + + @Override + protected void channelRead0(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { + LOG.info("New data read: {} bytes incoming", buffer.readableBytes()); + listener.onData(new Buffer(buffer)); + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org