Package java.util.concurrent

Examples of java.util.concurrent.ScheduledThreadPoolExecutor.allowCoreThreadTimeOut()


            private String createName() {
                return "oak-scheduled-executor-" + counter.getAndIncrement();
            }
        });
        executor.setKeepAliveTime(1, TimeUnit.MINUTES);
        executor.allowCoreThreadTimeOut(true);
        return executor;
    }

    /**
     * Default {@code ExecutorService} used for scheduling concurrent tasks.
View Full Code Here


            private String createName() {
                return "oak-scheduled-executor-" + counter.getAndIncrement();
            }
        });
        executor.setKeepAliveTime(1, TimeUnit.MINUTES);
        executor.allowCoreThreadTimeOut(true);
        return executor;
    }

    /**
     * Default {@code ExecutorService} used for scheduling concurrent tasks.
View Full Code Here

    }

    private static ScheduledThreadPoolExecutor buildBlockableExecutor() {
      final ScheduledThreadPoolExecutor stpe = new ScheduledThreadPoolExecutor(POOL_SIZE, THREAD_FACTORY);
      stpe.setKeepAliveTime(15L, TimeUnit.SECONDS);
      stpe.allowCoreThreadTimeOut(true);
      return stpe;
    }

    private synchronized void dispose() {
      if (this.exec != null) {
View Full Code Here

    final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
    // Let core threads time out to avoid unnecessarily keeping a flapping state check thread alive
    // for the majority of tasks that do not flap.
    executor.setKeepAliveTime(5, SECONDS);
    executor.allowCoreThreadTimeOut(true);
    this.scheduler = MoreExecutors.getExitingScheduledExecutorService(executor, 0, SECONDS);
  }

  /**
   * Get the current task throttle as derived from task runner events.
View Full Code Here

  private ResultListener<T> _listener;

  private static ScheduledExecutorService createTimeoutExecutor() {
    final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
    executor.setKeepAliveTime(60, TimeUnit.SECONDS);
    executor.allowCoreThreadTimeOut(true);
    executor.setThreadFactory(new NamedThreadPoolFactory("AsynchronousOperation-Timeout"));
    return executor;
  }

  /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.