3

I have following specific queries on migration

a) I am currently using IdleStateAwareChannelUpstreamHandler to handle channelIdle event along with other regular ChannelUpstream event callbacks. When this is migrated to 4.0x model, what should be the equivalent approach ?

b) What is the equivalent EventExecutor for OrdredMemoryAwareThreadPoolExecutor in 4.0x ?

c) In 3.2.6, I had used channelId from event objects of handler-callbacks to keep track of clients uniquely. For example, in channelConnected callback, I used to obtain the channelId from evt.getChannel().getId(). Since events are more fine-grained in 4.0x, what is the best way to obtain Netty-generated unique channel id ? I had checked if ChannelHandlerContext provides a means to obtain the same. But I could not find an equivalent

I am referring to javadocs at http://netty.io/4.0/api/

Thanks in advance

user1511595
  • 77
  • 1
  • 8

1 Answers1

2

a) See the javadocs of the IdleStateHandler. You need to intercept IdleStateEvents in the userEventTriggered(..) method.

b) specify a EventExecutor when adding a ChannelHandler to the ChannelPipeline. See No more ExecutionHandler - it's in the core.

c) There is currently no id() on the Channel anymore. You can use Channel.hashCode() for now. Most likely the id() will come back in a later release.

joschi
  • 12,746
  • 4
  • 44
  • 50
Norman Maurer
  • 23,104
  • 2
  • 33
  • 31