Identifying the thread which raises IdleStateEvent when using IdleStateHandler and ExecutionHandler

balluk balluk at yahoo.com
Tue Nov 23 06:41:09 EST 2010


Hi,

First of all I want to mention that Netty is superb and you guys are doing a
great job in supporting this wonderful product, and I hope that you will
continue...

Ok,now to my problem - I need to identify the pool thread that raises the
IdleStateEvent when I am using IdleStateHandler and ExecutionHandler.

Let me explain what I am doing.  

A client establishes a connection with the server and sends a fixed length
message.  The server (worker thread 1) spawns off a thread (pool thread A)
via execution handler, and hands off the message to a handler.  The handler
in turn calls business logic services to process the message.  Now the
requirement is the server should respond back to the client within 200ms for
each sent message, if the business services take longer than 200ms then the
server responds back with a default message but would not stop the
processing of message in the business services, and it should wait for the
pool thread A to return.  Meanwhile after receiving the first message the
client sends another message, now the server spawns off another pool thread
B to process the message, and so on.  I am using IdleStateHandler for
timeout and MemoryOrderedAwareThreadPoolExecutor for execution handler in my
pipeline.
Everything works fine as expected but the issue here is that I have no idea
which pool thread raises the IdleStateEvent in channelIdle method.  I have
to make sure that returned processed message from the thread which raises
the IdleStateEvent is never sent back to the client since a response is
already sent by the worker thread.  

I am sure somebody might have come across this situation in Netty.  Any help
or suggestion is greatly appreciated.

Here is my pipeline:

ChannelPipeline pipeline = Channels.pipeline();
		pipeline.addLast("decoder", new MessageDecoder(messageLength));
		pipeline.addLast("encoder", new MessageEncoder());
		pipeline.addLast("idler", new IdleStateHandler(timer, 200, 200, 200,
TimeUnit.MILLISECONDS)); //timer must be shared
		pipeline.addLast("executionHandler", executionHandler); //must be shared
		pipeline.addLast("handler", new MessageHandler(messageLength,
getMessageTimeoutResponse()));
		return pipeline;

Please let me know if you need more info.

Thank you very much
Ballu
-- 
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Identifying-the-thread-which-raises-IdleStateEvent-when-using-IdleStateHandler-and-ExecutionHandler-tp5766305p5766305.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list