List of usage examples for io.netty.channel.nio NioEventLoopGroup terminationFuture
@Override
public Future<?> terminationFuture()
From source file:org.glowroot.agent.central.EventLoopGroups.java
License:Apache License
static EventLoopGroup create(String name) { final ExecutorService executor = Executors.newSingleThreadExecutor(ThreadFactories.create(name)); NioEventLoopGroup nioEventLoopGroup = new NioEventLoopGroup(1, executor); nioEventLoopGroup.terminationFuture().addListener(new GenericFutureListener<Future<Object>>() { @Override/*from ww w. j a v a2 s . com*/ public void operationComplete(Future<Object> future) throws Exception { executor.shutdown(); if (!executor.awaitTermination(10, SECONDS)) { throw new IllegalStateException("Could not terminate executor"); } } }); return nioEventLoopGroup; }
From source file:org.glowroot.agent.it.harness.impl.EventLoopGroups.java
License:Apache License
static EventLoopGroup create(String name) { final ExecutorService executor = Executors .newSingleThreadExecutor(new ThreadFactoryBuilder().setDaemon(true).setNameFormat(name).build()); NioEventLoopGroup nioEventLoopGroup = new NioEventLoopGroup(1, executor); nioEventLoopGroup.terminationFuture().addListener(new GenericFutureListener<Future<Object>>() { @Override/*from w w w . j av a 2s . c o m*/ public void operationComplete(Future<Object> future) throws Exception { executor.shutdown(); if (!executor.awaitTermination(10, SECONDS)) { throw new IllegalStateException("Could not terminate executor"); } } }); return nioEventLoopGroup; }
From source file:org.glowroot.central.EventLoopGroups.java
License:Apache License
static EventLoopGroup create(String name) { ThreadFactory threadFactory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat(name + "-%d") .build();//from w w w . j ava 2s . c o m final ExecutorService executor = Executors.newSingleThreadExecutor(threadFactory); NioEventLoopGroup nioEventLoopGroup = new NioEventLoopGroup(1, executor); nioEventLoopGroup.terminationFuture().addListener(new GenericFutureListener<Future<Object>>() { @Override public void operationComplete(Future<Object> future) throws Exception { executor.shutdown(); if (!executor.awaitTermination(10, SECONDS)) { throw new IllegalStateException("Could not terminate executor"); } } }); return nioEventLoopGroup; }