Class CommandScheduler

  • All Implemented Interfaces:
    net.jodah.failsafe.util.concurrent.Scheduler

    public class CommandScheduler
    extends Object
    implements net.jodah.failsafe.util.concurrent.Scheduler
    Class CommandScheduler.
    • Method Detail

      • create

        public static CommandScheduler create​(int threadPoolSize)
        If no command scheduler exists, creates one using default values. Disables daemon threads.
        Parameters:
        threadPoolSize - Size of thread pool for async commands.
        Returns:
        Existing scheduler or newly created one.
      • schedule

        public ScheduledFuture<?> schedule​(Callable<?> callable,
                                           long delay,
                                           TimeUnit unit)
        Schedules a task using an executor. Returns a wrapped future with special logic to handle cancellations of async bulkhead tasks that have been queued but have not executed yet. Without forcing interruption of those tasks (see flag), they would be allowed to start once the bulkhead is freed.
        Specified by:
        schedule in interface net.jodah.failsafe.util.concurrent.Scheduler
        Parameters:
        callable - The callable.
        delay - Delay before scheduling task.
        unit - Unite of delay.
        Returns:
        Future to track task execution.