io.netty.channel.nio.NioEventLoopGroup.terminationFuture()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中io.netty.channel.nio.NioEventLoopGroup.terminationFuture()方法的一些代码示例,展示了NioEventLoopGroup.terminationFuture()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NioEventLoopGroup.terminationFuture()方法的具体详情如下:
包路径:io.netty.channel.nio.NioEventLoopGroup
类名称:NioEventLoopGroup
方法名:terminationFuture

NioEventLoopGroup.terminationFuture介绍

暂无

代码示例

代码示例来源:origin: glowroot/glowroot

static EventLoopGroup create(String name) {
    final ExecutorService executor = Executors.newSingleThreadExecutor(
        new ThreadFactoryBuilder()
            .setDaemon(true)
            .setNameFormat(name)
            .build());
    NioEventLoopGroup nioEventLoopGroup = new NioEventLoopGroup(1, executor);
    nioEventLoopGroup.terminationFuture()
        .addListener(new GenericFutureListener<Future</*@Nullable*/ Object>>() {
          @Override
          public void operationComplete(Future</*@Nullable*/ Object> future)
              throws Exception {
            executor.shutdown();
            if (!executor.awaitTermination(10, SECONDS)) {
              throw new IllegalStateException("Could not terminate executor");
            }
          }
        });
    return nioEventLoopGroup;
  }
}

代码示例来源:origin: glowroot/glowroot

static EventLoopGroup create(String name) {
    final ExecutorService executor =
        Executors.newSingleThreadExecutor(ThreadFactories.create(name));
    NioEventLoopGroup nioEventLoopGroup = new NioEventLoopGroup(1, executor);
    nioEventLoopGroup.terminationFuture()
        .addListener(new GenericFutureListener<Future</*@Nullable*/ Object>>() {
          @Override
          public void operationComplete(Future</*@Nullable*/ Object> future)
              throws Exception {
            executor.shutdown();
            if (!executor.awaitTermination(10, SECONDS)) {
              throw new IllegalStateException("Could not terminate executor");
            }
          }
        });
    return nioEventLoopGroup;
  }
}

代码示例来源:origin: org.apache.carbondata/carbondata-core

/**
  * shutdown dictionary client
  */
 @Override public void shutDown() {
  workerGroup.shutdownGracefully();
  try {
   workerGroup.terminationFuture().sync();
  } catch (InterruptedException e) {
   LOGGER.error(e);
  }
 }
}

代码示例来源:origin: com.linkedin.pegasus/r2-netty

@Override
 public void waitForStop() throws InterruptedException
 {
  _bossGroup.terminationFuture().await();
  _workerGroup.terminationFuture().await();
  _eventExecutors.terminationFuture().await();
 }
}

代码示例来源:origin: io.netty/netty-testsuite

connectGroup.shutdownGracefully();
acceptGroup.terminationFuture().syncUninterruptibly();
connectGroup.terminationFuture().syncUninterruptibly();

相关文章