ARTEMIS-1158 exposing Netty.channelID properly

This commit is contained in:
Clebert Suconic 2017-05-10 18:06:46 -04:00
parent ab6806c38b
commit 02dcfe0468
4 changed files with 6 additions and 6 deletions

View File

@ -57,7 +57,6 @@ public class ActiveMQChannelHandler extends ChannelDuplexHandler {
@Override @Override
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
// TODO: Think about the id thingy
listener.connectionReadyForWrites(channelId(ctx.channel()), ctx.channel().isWritable()); listener.connectionReadyForWrites(channelId(ctx.channel()), ctx.channel().isWritable());
} }
@ -107,7 +106,7 @@ public class ActiveMQChannelHandler extends ChannelDuplexHandler {
} }
} }
protected static int channelId(Channel channel) { protected static Object channelId(Channel channel) {
return channel.hashCode(); return channel.id();
} }
} }

View File

@ -266,8 +266,7 @@ public class NettyConnection implements Connection {
@Override @Override
public final Object getID() { public final Object getID() {
// TODO: Think of it return channel.id();
return channel.hashCode();
} }
// This is called periodically to flush the batch buffer // This is called periodically to flush the batch buffer

View File

@ -111,6 +111,8 @@ public class ConsumerTest extends ActiveMQTestBase {
ClientSessionFactory sf = createSessionFactory(locator); ClientSessionFactory sf = createSessionFactory(locator);
ClientSessionFactory sf2 = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true, true); ClientSession session = sf.createSession(false, true, true, true);
server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false); server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false);

View File

@ -44,7 +44,7 @@ public class NettyConnectionTest extends ActiveMQTestBase {
Channel channel = createChannel(); Channel channel = createChannel();
NettyConnection conn = new NettyConnection(emptyMap, channel, new MyListener(), false, false); NettyConnection conn = new NettyConnection(emptyMap, channel, new MyListener(), false, false);
Assert.assertEquals(channel.hashCode(), conn.getID()); Assert.assertEquals(channel.id(), conn.getID());
} }
@Test @Test