Package com.tick42.glue.core
Interface Scheduler
-
public interface SchedulerAbstract boundary for asynchronous task scheduling and execution.- Since:
- 1.1
- See Also:
of(ScheduledExecutorService),of(Timer)
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static Schedulerof(ScheduledExecutorService executor)ReturnSchedulerwhich uses backingScheduledExecutorServiceto schedule tasks for asynchronous execution.static Schedulerof(Timer timer)default AsynchronousCloseableschedule(Runnable action)Schedules a specified task for execution as soon as possible.AsynchronousCloseableschedule(Runnable action, long delay, TimeUnit unit)Schedules a specified task for execution after specified delay.default AsynchronousCloseableschedule(Runnable action, Duration delay)Schedules a specified task for execution after specified delay.
-
-
-
Method Detail
-
schedule
AsynchronousCloseable schedule(Runnable action, long delay, TimeUnit unit)
Schedules a specified task for execution after specified delay.- Parameters:
action- action to executedelay- delay amountunit- delay unit- Returns:
AsynchronousCloseableused to cancel execution, nevernull
-
schedule
default AsynchronousCloseable schedule(Runnable action)
Schedules a specified task for execution as soon as possible.- Parameters:
action- action to execute- Returns:
AsynchronousCloseableused to cancel execution, nevernull
-
schedule
default AsynchronousCloseable schedule(Runnable action, Duration delay)
Schedules a specified task for execution after specified delay.- Parameters:
action- action to executedelay- delay- Returns:
AsynchronousCloseableused to cancel execution, nevernull
-
of
static Scheduler of(ScheduledExecutorService executor)
ReturnSchedulerwhich uses backingScheduledExecutorServiceto schedule tasks for asynchronous execution.- Parameters:
executor- an executor- Returns:
- new scheduler, never
null
-
-