Example usage for io.netty.channel.group ChannelGroupFuture awaitUninterruptibly

List of usage examples for io.netty.channel.group ChannelGroupFuture awaitUninterruptibly

Introduction

In this page you can find the example usage for io.netty.channel.group ChannelGroupFuture awaitUninterruptibly.

Prototype

boolean awaitUninterruptibly(long timeout, TimeUnit unit);

Source Link

Document

Waits for this future to be completed within the specified time limit without interruption.

Usage

From source file:poke.server.Server.java

License:Apache License

/**
 * static because we need to get a handle to the factory from the shutdown
 * resource/*from  ww  w .  j  a v  a  2s. c om*/
 */
public static void shutdown() {
    try {
        if (allChannels != null) {
            ChannelGroupFuture grp = allChannels.close();
            grp.awaitUninterruptibly(5, TimeUnit.SECONDS);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    logger.info("Server shutdown");
    System.exit(0);
}