コード例 #1
0
  AsynchronousChannelGroupImpl(AsynchronousChannelProvider provider, ThreadPool pool) {
    super(provider);
    this.pool = pool;

    if (pool.isFixedThreadPool()) {
      taskQueue = new ConcurrentLinkedQueue<Runnable>();
    } else {
      taskQueue = null; // not used
    }

    // use default thread factory as thread should not be visible to
    // application (it doesn't execute completion handlers).
    this.timeoutExecutor =
        (ScheduledThreadPoolExecutor)
            Executors.newScheduledThreadPool(1, ThreadPool.defaultThreadFactory());
    this.timeoutExecutor.setRemoveOnCancelPolicy(true);
  }
コード例 #2
0
 final boolean isFixedThreadPool() {
   return pool.isFixedThreadPool();
 }