HashedWheelTimer should be shared?
javadevmtl
java.dev.mtl at gmail.com
Thu Jul 1 09:40:18 EDT 2010
Yes. Initialize outside the pipeline and pass in to the pipeline.
So something like...
MyMain
{
Timer timer;
main(String args[])
{
timer = new HashedWheelTimer();
bootstrap.setPipelineFactory(new MyPipelineFactory(timer));
...
// On shutdown
timer.stop();
}
}
public class MyPipelineFactory implements ChannelPipelineFactory {
private final Timer timer;
public MyPipelineFactory(Timer timer, ExecutionHandler executionHandler)
{
this.timer = timer;
}
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("timeout", new ReadTimeoutHandler(timer, 3000,
TimeUnit.MILLISECONDS));
pipeline.addLast(...);
...
return pipeline;
}
}
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/HashedWheelTimer-should-be-shared-tp5241561p5243429.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list