diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java index feb19f5275..1542b05297 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java @@ -57,7 +57,6 @@ public class ActiveMQChannelHandler extends ChannelDuplexHandler { @Override public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { - // TODO: Think about the id thingy listener.connectionReadyForWrites(channelId(ctx.channel()), ctx.channel().isWritable()); } @@ -107,7 +106,7 @@ public class ActiveMQChannelHandler extends ChannelDuplexHandler { } } - protected static int channelId(Channel channel) { - return channel.hashCode(); + protected static Object channelId(Channel channel) { + return channel.id(); } } 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 2c03ed6eb9..0316b1517f 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 @@ -266,8 +266,7 @@ public class NettyConnection implements Connection { @Override public final Object getID() { - // TODO: Think of it - return channel.hashCode(); + return channel.id(); } // This is called periodically to flush the batch buffer diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java index 4a0ef04a55..28200cf981 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java @@ -111,6 +111,8 @@ public class ConsumerTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); + ClientSessionFactory sf2 = createSessionFactory(locator); + ClientSession session = sf.createSession(false, true, true, true); server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java index 3801e7e1c8..8d8e4829fd 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java @@ -44,7 +44,7 @@ public class NettyConnectionTest extends ActiveMQTestBase { Channel channel = createChannel(); NettyConnection conn = new NettyConnection(emptyMap, channel, new MyListener(), false, false); - Assert.assertEquals(channel.hashCode(), conn.getID()); + Assert.assertEquals(channel.id(), conn.getID()); } @Test