Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netty Simple channel handler disconnection is get blocked

Tags:

java

netty

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);
like image 259
user2067201 Avatar asked Nov 04 '22 01:11

user2067201


1 Answers

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 !!

like image 113
Alankar Srivastava Avatar answered Nov 14 '22 22:11

Alankar Srivastava