user2067201
user2067201

Reputation: 258

Netty Simple channel handler disconnection is get blocked

My Netty channel handler channelClosed () is get blocked while another message being received at messageReceived().
I used OrderedMemoryAwareThreadPoolExecutor for synchronising messages.
Is channelClosed() processed by low priority thread.?

Could you please tell about thread priority in netty. Thank you

    objChannelPipeline.addLast("ipFilter", objCustomIPFilterHandler);
    objChannelPipeline.addLast("idleHandler", new IdleStateHandler(timer,5,5, 0));
    objChannelPipeline.addLast("loggingHandler", objLoggingHandler);        
    objChannelPipeline.addLast("frameDecoder",
            new DelimiterBasedFrameDecoder(Integer.MAX_VALUE, false, ChannelBuffers.copiedBuffer("\n\n".getBytes(CharsetUtil.UTF_8))));
    objChannelPipeline.addLast("messageDecoder", new CustomMessageDecoder());
    objChannelPipeline.addLast("groupOrder", executionHandler);
    objChannelPipeline.addLast("ProtocolMultiplexer", CustomHandler);

Upvotes: 5

Views: 663

Answers (1)

Alankar Srivastava
Alankar Srivastava

Reputation: 864

I guess this is because you are using OrderedMemoryAwareThreadPoolExecutor, in this case events will be executed in the order in which they happen. Hence messageReceived() will always execute before channelClose().

So if you have received 3 message received and after that the channel is closed, then first three times messageReceived will be executed and after that only channelClose() will be executed.

If you use MemoryAwareThreadPoolExecutor than in this case channelClose can get invoked before messageReceived() as here the execution of events are not ordered.

Hope this helps !!

Upvotes: 2

Related Questions