"Long running" handlers
infectedrhytms
infectedrhythms at hotmail.com
Fri Mar 5 00:12:59 EST 2010
private static final ChannelHandler stringDecoder = new StringDecoder();
private static final ChannelHandler stringEncoder = new StringEncoder();
//private static final ChannelHandler isoHandler = new MyHandler();
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 0,
2, 0, 2));
pipeline.addLast("decoder", stringDecoder);
pipeline.addLast("frameEncoder", new LengthFieldPrepender(2));
pipeline.addLast("encoder", stringEncoder);
pipeline.addLast("handler", new MyHandler()); // Calls JDBC stored
procedure, business logic.
return pipeline;
}
MyHandler does the logic and the stored procedure call. This doesn't take up
any CPU time since the handler is waiting on the database to finish, but it
shouldn't stall/queue other incoming requests.
--
View this message in context: http://n2.nabble.com/Long-running-handlers-tp4677280p4679153.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list