Java Code Examples for io.netty.util.concurrent.Future#syncUninterruptibly()

The following examples show how to use io.netty.util.concurrent.Future#syncUninterruptibly() . 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: Http2ConnectionRoundtripTest.java    From netty-4.1.22 with Apache License 2.0 6 votes vote down vote up
@After
public void teardown() throws Exception {
    if (clientChannel != null) {
        clientChannel.close().syncUninterruptibly();
        clientChannel = null;
    }
    if (serverChannel != null) {
        serverChannel.close().syncUninterruptibly();
        serverChannel = null;
    }
    final Channel serverConnectedChannel = this.serverConnectedChannel;
    if (serverConnectedChannel != null) {
        serverConnectedChannel.close().syncUninterruptibly();
        this.serverConnectedChannel = null;
    }
    Future<?> serverGroup = sb.config().group().shutdownGracefully(0, 5, SECONDS);
    Future<?> serverChildGroup = sb.config().childGroup().shutdownGracefully(0, 5, SECONDS);
    Future<?> clientGroup = cb.config().group().shutdownGracefully(0, 5, SECONDS);
    serverGroup.syncUninterruptibly();
    serverChildGroup.syncUninterruptibly();
    clientGroup.syncUninterruptibly();
}
 
Example 2
Source File: InboundHttp2ToHttpAdapterTest.java    From netty-4.1.22 with Apache License 2.0 6 votes vote down vote up
@After
public void teardown() throws Exception {
    cleanupCapturedRequests();
    cleanupCapturedResponses();
    if (clientChannel != null) {
        clientChannel.close().syncUninterruptibly();
        clientChannel = null;
    }
    if (serverChannel != null) {
        serverChannel.close().syncUninterruptibly();
        serverChannel = null;
    }
    final Channel serverConnectedChannel = this.serverConnectedChannel;
    if (serverConnectedChannel != null) {
        serverConnectedChannel.close().syncUninterruptibly();
        this.serverConnectedChannel = null;
    }
    Future<?> serverGroup = sb.config().group().shutdownGracefully(0, 5, SECONDS);
    Future<?> serverChildGroup = sb.config().childGroup().shutdownGracefully(0, 5, SECONDS);
    Future<?> clientGroup = cb.config().group().shutdownGracefully(0, 5, SECONDS);
    serverGroup.syncUninterruptibly();
    serverChildGroup.syncUninterruptibly();
    clientGroup.syncUninterruptibly();
}
 
Example 3
Source File: HttpToHttp2ConnectionHandlerTest.java    From netty-4.1.22 with Apache License 2.0 6 votes vote down vote up
@After
public void teardown() throws Exception {
    if (clientChannel != null) {
        clientChannel.close().syncUninterruptibly();
        clientChannel = null;
    }
    if (serverChannel != null) {
        serverChannel.close().syncUninterruptibly();
        serverChannel = null;
    }
    final Channel serverConnectedChannel = this.serverConnectedChannel;
    if (serverConnectedChannel != null) {
        serverConnectedChannel.close().syncUninterruptibly();
        this.serverConnectedChannel = null;
    }
    Future<?> serverGroup = sb.config().group().shutdownGracefully(0, 5, SECONDS);
    Future<?> serverChildGroup = sb.config().childGroup().shutdownGracefully(0, 5, SECONDS);
    Future<?> clientGroup = cb.config().group().shutdownGracefully(0, 5, SECONDS);
    serverGroup.syncUninterruptibly();
    serverChildGroup.syncUninterruptibly();
    clientGroup.syncUninterruptibly();
}
 
Example 4
Source File: NettyShutdownHook.java    From hivemq-community-edition with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    log.debug("Shutting down worker and boss threads");
    final Future<?> workerFinished = workerGroup.shutdownGracefully(2, timeout, TimeUnit.SECONDS); //TimeUnit effects both parameters!
    final Future<?> bossFinished = bossGroup.shutdownGracefully(2, timeout, TimeUnit.SECONDS);

    log.trace("Waiting for Worker threads to finish");
    workerFinished.syncUninterruptibly();
    log.trace("Waiting for Boss threads to finish");
    bossFinished.syncUninterruptibly();
}
 
Example 5
Source File: DNSMonitor.java    From redisson with Apache License 2.0 5 votes vote down vote up
public DNSMonitor(ConnectionManager connectionManager, RedisClient masterHost, Collection<RedisURI> slaveHosts, long dnsMonitoringInterval, AddressResolverGroup<InetSocketAddress> resolverGroup) {
    this.resolver = resolverGroup.getResolver(connectionManager.getGroup().next());
    
    masterHost.resolveAddr().syncUninterruptibly();
    masters.put(masterHost.getConfig().getAddress(), masterHost.getAddr());
    
    for (RedisURI host : slaveHosts) {
        Future<InetSocketAddress> resolveFuture = resolver.resolve(InetSocketAddress.createUnresolved(host.getHost(), host.getPort()));
        resolveFuture.syncUninterruptibly();
        slaves.put(host, resolveFuture.getNow());
    }
    this.connectionManager = connectionManager;
    this.dnsMonitoringInterval = dnsMonitoringInterval;
}
 
Example 6
Source File: RespServer.java    From resp-server with MIT License 4 votes vote down vote up
private void closeFuture(Future<?> future) {
  LOGGER.debug("closing future");
  future.syncUninterruptibly();
  LOGGER.debug("future closed");
}