Class AbstractThreadPoolStrategy

    • Field Detail

      • threadPool

        private final java.util.concurrent.ExecutorService threadPool
      • futureResults

        private final java.util.Collection<java.util.concurrent.Future<?>> futureResults
      • isDestroyed

        private volatile boolean isDestroyed
    • Constructor Detail

      • AbstractThreadPoolStrategy

        AbstractThreadPoolStrategy​(ConsoleStream logger,
                                   java.util.concurrent.ExecutorService threadPool)
      • AbstractThreadPoolStrategy

        AbstractThreadPoolStrategy​(ConsoleStream logger,
                                   java.util.concurrent.ExecutorService threadPool,
                                   java.util.Collection<java.util.concurrent.Future<?>> futureResults)
    • Method Detail

      • getThreadPool

        protected final java.util.concurrent.ExecutorService getThreadPool()
      • getFutureResults

        protected final java.util.Collection<java.util.concurrent.Future<?>> getFutureResults()
      • stop

        protected boolean stop()
        Description copied from class: SchedulingStrategy
        Stops scheduling new tasks (e.g. by ExecutorService.shutdown() on a private thread pool which cannot be shared with other strategy).
        Specified by:
        stop in class SchedulingStrategy
        Returns:
        true if successfully stopped the scheduler, else false if already stopped (a shared thread pool was shutdown externally).
        See Also:
        ExecutorService.shutdown()
      • stopNow

        protected boolean stopNow()
        Description copied from class: SchedulingStrategy
        Stops scheduling new tasks and interrupts running tasks (e.g. by ExecutorService.shutdownNow() on a private thread pool which cannot be shared with other strategy).
        This method calls SchedulingStrategy.stop() by default.
        Overrides:
        stopNow in class SchedulingStrategy
        Returns:
        true if successfully stopped the scheduler, else false if already stopped (a shared thread pool was shutdown externally).
        See Also:
        ExecutorService.shutdownNow()
      • destroy

        public boolean destroy()
        Description copied from interface: Destroyable
        Calling ThreadPoolExecutor.shutdown() and ThreadPoolExecutor.awaitTermination(long, java.util.concurrent.TimeUnit).
        Returns:
        true if not interrupted in current thread