Package com.tick42.glue.core

# Interface Scheduler

    public interface Scheduler

Abstract boundary for asynchronous task scheduling and execution.

Since:
  1.1
See Also:
  `of(ScheduledExecutorService)`, `of(Timer)`

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `static Scheduler` | `of​(ScheduledExecutorService executor)` | Return `Scheduler` which uses backing `ScheduledExecutorService` to schedule tasks for asynchronous execution.
  `static Scheduler` | `of​(Timer timer)` | Return `Scheduler` which uses backing `Timer` to schedule tasks for asynchronous execution.
  `default AsynchronousCloseable` | `schedule​(Runnable action)` | Schedules a specified task for execution as soon as possible.
  `AsynchronousCloseable` | `schedule​(Runnable action, long delay, TimeUnit unit)` | Schedules a specified task for execution after specified delay.
  `default AsynchronousCloseable` | `schedule​(Runnable action, Duration delay)` | Schedules a specified task for execution after specified delay.

- ## Method Details

  - ### schedule

    AsynchronousCloseable schedule​(Runnable action, long delay, TimeUnit unit)
    Schedules a specified task for execution after specified delay.
    Parameters:
      `action` - action to execute
      `delay` - delay amount
      `unit` - delay unit
    Returns:
      `AsynchronousCloseable` used to cancel execution, never `null`

  - ### schedule

    default AsynchronousCloseable schedule​(Runnable action)
    Schedules a specified task for execution as soon as possible.
    Parameters:
      `action` - action to execute
    Returns:
      `AsynchronousCloseable` used to cancel execution, never `null`

  - ### schedule

    default AsynchronousCloseable schedule​(Runnable action, Duration delay)
    Schedules a specified task for execution after specified delay.
    Parameters:
      `action` - action to execute
      `delay` - delay
    Returns:
      `AsynchronousCloseable` used to cancel execution, never `null`

  - ### of

    static Scheduler of​(ScheduledExecutorService executor)
    Return `Scheduler` which uses backing `ScheduledExecutorService` to schedule tasks for asynchronous execution.
    Parameters:
      `executor` - an executor
    Returns:
      new scheduler, never `null`

  - ### of

    static Scheduler of​(Timer timer)
    Return `Scheduler` which uses backing `Timer` to schedule tasks for asynchronous execution.
    Parameters:
      `timer` - a timer
    Returns:
      new scheduler, never `null`