Java Code Examples for io.netty.channel.group.ChannelGroupFuture#await()
The following examples show how to use
io.netty.channel.group.ChannelGroupFuture#await() .
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: ServerGroups.java From serve with Apache License 2.0 | 6 votes |
private void closeAllChannels(boolean graceful) { ChannelGroupFuture future = allChannels.close(); // if this is a graceful shutdown, log any channel closing failures. if this isn't a // graceful shutdown, ignore them. if (graceful) { try { future.await(10, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } if (!future.isSuccess()) { for (ChannelFuture cf : future) { if (!cf.isSuccess()) { logger.info("Unable to close channel: " + cf.channel(), cf.cause()); } } } } }
Example 2
Source File: DefaultHttpProxyServer.java From g4proxy with Apache License 2.0 | 6 votes |
/** * Closes all channels opened by this proxy server. * * @param graceful when false, attempts to shutdown all channels immediately and ignores any channel-closing exceptions */ protected void closeAllChannels(boolean graceful) { LOG.info("Closing all channels " + (graceful ? "(graceful)" : "(non-graceful)")); ChannelGroupFuture future = allChannels.close(); // if this is a graceful shutdown, log any channel closing failures. if this isn't a graceful shutdown, ignore them. if (graceful) { try { future.await(10, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); LOG.warn("Interrupted while waiting for channels to shut down gracefully."); } if (!future.isSuccess()) { for (ChannelFuture cf : future) { if (!cf.isSuccess()) { LOG.info("Unable to close channel. Cause of failure for {} is {}", cf.channel(), cf.cause()); } } } } }
Example 3
Source File: ServerGroups.java From multi-model-server with Apache License 2.0 | 6 votes |
private void closeAllChannels(boolean graceful) { ChannelGroupFuture future = allChannels.close(); // if this is a graceful shutdown, log any channel closing failures. if this isn't a // graceful shutdown, ignore them. if (graceful) { try { future.await(10, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } if (!future.isSuccess()) { for (ChannelFuture cf : future) { if (!cf.isSuccess()) { logger.info("Unable to close channel: " + cf.channel(), cf.cause()); } } } } }