stop the timer when closing the http server

This commit is contained in:
kimchy 2010-03-16 02:18:28 +02:00
parent 20877a0c79
commit 1d2d4674cf
1 changed files with 5 additions and 1 deletions

View File

@ -109,6 +109,8 @@ public class NettyHttpServerTransport extends AbstractComponent implements HttpS
private volatile HttpServerAdapter httpServerAdapter;
private HashedWheelTimer keepAliveTimer;
@Inject public NettyHttpServerTransport(Settings settings, ThreadPool threadPool) {
super(settings);
this.threadPool = threadPool;
@ -157,7 +159,7 @@ public class NettyHttpServerTransport extends AbstractComponent implements HttpS
Executors.newCachedThreadPool(daemonThreadFactory(settings, "httpIoWorker")),
workerCount));
final HashedWheelTimer keepAliveTimer = new HashedWheelTimer(daemonThreadFactory(settings, "keepAliveTimer"), httpKeepAliveTickDuration.millis(), TimeUnit.MILLISECONDS);
keepAliveTimer = new HashedWheelTimer(daemonThreadFactory(settings, "keepAliveTimer"), httpKeepAliveTickDuration.millis(), TimeUnit.MILLISECONDS);
final HttpRequestHandler requestHandler = new HttpRequestHandler(this);
ChannelPipelineFactory pipelineFactory = new ChannelPipelineFactory() {
@ -253,6 +255,8 @@ public class NettyHttpServerTransport extends AbstractComponent implements HttpS
serverOpenChannels = null;
}
keepAliveTimer.stop();
if (serverBootstrap != null) {
serverBootstrap.releaseExternalResources();
serverBootstrap = null;