@SuppressWarnings("unchecked") @Override public void accept(Void v) { GenericFutureListener listener = new GenericFutureListener() { @Override public void operationComplete(Future future) throws Exception { if (future.isSuccess()) { d.accept(true); } else { d.accept(future.cause()); } } }; if (null == nettyOptions || null == nettyOptions.eventLoopGroup()) { ioGroup.shutdownGracefully().addListener(listener); } } },
@SuppressWarnings({"rawtypes", "unchecked"}) @Override public void accept(Void v) { final AtomicInteger groupsToShutdown = new AtomicInteger(2); GenericFutureListener listener = new GenericFutureListener() { @Override public void operationComplete(Future future) throws Exception { if (groupsToShutdown.decrementAndGet() == 0) { notifyShutdown(); d.accept(true); } } }; selectorGroup.shutdownGracefully().addListener(listener); if (null == nettyOptions || null == nettyOptions.eventLoopGroup()) { ioGroup.shutdownGracefully().addListener(listener); } } },
if (null != nettyOptions && null != nettyOptions.eventLoopGroup()) { this.ioGroup = nettyOptions.eventLoopGroup(); } else { int ioThreadCount = env.getProperty("reactor.udp.ioThreadCount",
int ioThreadCount = env.getProperty("reactor.tcp.ioThreadCount", Integer.class, Environment.PROCESSORS); this.selectorGroup = new NioEventLoopGroup(selectThreadCount, new NamedDaemonThreadFactory("reactor-tcp-select")); if (null != nettyOptions && null != nettyOptions.eventLoopGroup()) { this.ioGroup = nettyOptions.eventLoopGroup(); } else { this.ioGroup = new NioEventLoopGroup(ioThreadCount, new NamedDaemonThreadFactory("reactor-tcp-io"));