user1511595
user1511595

Reputation: 77

Netty 3.2.6 to Netty 4.0x migration

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

Upvotes: 3

Views: 3467

Answers (1)

Norman Maurer
Norman Maurer

Reputation: 23557

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.

Upvotes: 2

Related Questions