Java Code Examples for io.netty.channel.group.ChannelGroupFuture#awaitUninterruptibly()
The following examples show how to use
io.netty.channel.group.ChannelGroupFuture#awaitUninterruptibly() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ByteTransport.java From incubator-nemo with Apache License 2.0 | 6 votes |
/** * Closes all channels and releases all resources. */ @Override public void close() { LOG.info("Stopping listening at {} and closing", serverListeningChannel.localAddress()); final ChannelFuture closeListeningChannelFuture = serverListeningChannel.close(); final ChannelGroupFuture channelGroupCloseFuture = channelGroup.close(); final Future serverListeningGroupCloseFuture = serverListeningGroup.shutdownGracefully(); final Future serverWorkingGroupCloseFuture = serverWorkingGroup.shutdownGracefully(); final Future clientGroupCloseFuture = clientGroup.shutdownGracefully(); closeListeningChannelFuture.awaitUninterruptibly(); channelGroupCloseFuture.awaitUninterruptibly(); serverListeningGroupCloseFuture.awaitUninterruptibly(); serverWorkingGroupCloseFuture.awaitUninterruptibly(); clientGroupCloseFuture.awaitUninterruptibly(); }
Example 2
Source File: NettyHttpServer.java From krpc with Apache License 2.0 | 6 votes |
public void close() { if (workerGroup != null) { log.info("stopping netty server"); bossGroup.shutdownGracefully(); bossGroup = null; ChannelGroup allChannels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE); allChannels.add(serverChannel); for (Channel ch : conns.values()) { allChannels.add(ch); } ChannelGroupFuture future = allChannels.close(); future.awaitUninterruptibly(); workerGroup.shutdownGracefully(); workerGroup = null; log.info("netty server stopped"); } }
Example 3
Source File: NettyClient.java From krpc with Apache License 2.0 | 6 votes |
public void close() { if (workerGroup != null) { log.info("stopping netty client"); timer.stop(); timer = null; ChannelGroup allChannels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE); for (Object ch : conns.values()) { if (ch != null && ch != dummyChannel) allChannels.add((Channel) ch); } ChannelGroupFuture future = allChannels.close(); future.awaitUninterruptibly(); workerGroup.shutdownGracefully(); workerGroup = null; log.info("netty client stopped"); } }
Example 4
Source File: NettyServer.java From krpc with Apache License 2.0 | 6 votes |
public void close() { if (workerGroup != null) { log.info("stopping netty server"); bossGroup.shutdownGracefully(); bossGroup = null; ChannelGroup allChannels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE); allChannels.add(serverChannel); for (Channel ch : conns.values()) { allChannels.add(ch); } ChannelGroupFuture future = allChannels.close(); future.awaitUninterruptibly(); workerGroup.shutdownGracefully(); workerGroup = null; log.info("netty server stopped"); } }
Example 5
Source File: SelfCheckHttpServer.java From krpc with Apache License 2.0 | 6 votes |
public void close() { if (workerGroup != null) { log.info("stopping selfcheck server"); bossGroup.shutdownGracefully(); bossGroup = null; ChannelGroup allChannels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE); allChannels.add(serverChannel); for (Channel ch : conns.values()) { allChannels.add(ch); } ChannelGroupFuture future = allChannels.close(); future.awaitUninterruptibly(); workerGroup.shutdownGracefully(); workerGroup = null; log.info("selfcheck server stopped"); } }
Example 6
Source File: CatNettyClient.java From krpc with Apache License 2.0 | 6 votes |
public void close() { if (workerGroup != null) { log.info("cat stopping netty client"); timer.cancel(); timer = null; ChannelGroup allChannels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE); for (Object ch : conns.values()) { if (ch != null && ch != dummyChannel) allChannels.add((Channel) ch); } ChannelGroupFuture future = allChannels.close(); future.awaitUninterruptibly(); workerGroup.shutdownGracefully(); workerGroup = null; log.info("cat netty client stopped"); } }
Example 7
Source File: ByteTransport.java From nemo with Apache License 2.0 | 6 votes |
/** * Closes all channels and releases all resources. */ @Override public void close() { LOG.info("Stopping listening at {} and closing", serverListeningChannel.localAddress()); final ChannelFuture closeListeningChannelFuture = serverListeningChannel.close(); final ChannelGroupFuture channelGroupCloseFuture = channelGroup.close(); final Future serverListeningGroupCloseFuture = serverListeningGroup.shutdownGracefully(); final Future serverWorkingGroupCloseFuture = serverWorkingGroup.shutdownGracefully(); final Future clientGroupCloseFuture = clientGroup.shutdownGracefully(); closeListeningChannelFuture.awaitUninterruptibly(); channelGroupCloseFuture.awaitUninterruptibly(); serverListeningGroupCloseFuture.awaitUninterruptibly(); serverWorkingGroupCloseFuture.awaitUninterruptibly(); clientGroupCloseFuture.awaitUninterruptibly(); }
Example 8
Source File: NettyAcceptor.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override public void reload() { ChannelGroupFuture future = serverChannelGroup.disconnect(); try { future.awaitUninterruptibly(); } catch (Exception ignored) { } serverChannelGroup.clear(); startServerChannels(); }
Example 9
Source File: NettyMessagingTransport.java From reef with Apache License 2.0 | 5 votes |
/** * Closes all channels and releases all resources. */ @Override public void close() { LOG.log(Level.FINE, "Closing netty transport socket address: {0}", this.localAddress); final ChannelGroupFuture clientChannelGroupFuture = this.clientChannelGroup.close(); final ChannelGroupFuture serverChannelGroupFuture = this.serverChannelGroup.close(); final ChannelFuture acceptorFuture = this.acceptor.close(); final ArrayList<Future> eventLoopGroupFutures = new ArrayList<>(3); eventLoopGroupFutures.add(this.clientWorkerGroup.shutdownGracefully()); eventLoopGroupFutures.add(this.serverBossGroup.shutdownGracefully()); eventLoopGroupFutures.add(this.serverWorkerGroup.shutdownGracefully()); clientChannelGroupFuture.awaitUninterruptibly(); serverChannelGroupFuture.awaitUninterruptibly(); try { acceptorFuture.sync(); } catch (final Exception ex) { LOG.log(Level.SEVERE, "Error closing the acceptor channel for " + this.localAddress, ex); } for (final Future eventLoopGroupFuture : eventLoopGroupFutures) { eventLoopGroupFuture.awaitUninterruptibly(); } LOG.log(Level.FINE, "Closing netty transport socket address: {0} done", this.localAddress); }