Package com.glitchybyte.glib.concurrent
Interface GTaskScheduler
- All Superinterfaces:
Executor
- All Known Implementing Classes:
GTaskSchedulerService
A scheduler utility on top of
ScheduledExecutorService.
This class standardizes the interface to use Duration for timings.
-
Method Summary
Modifier and TypeMethodDescriptionSchedules a one-shot task.scheduleAtFixedRate(Duration initialDelay, Duration period, Runnable runnable) Schedules a task to run at a fixed delay.scheduleWithFixedDelay(Duration initialDelay, Duration delay, Runnable runnable) Schedules a task at a delay after each run.
-
Method Details
-
schedule
Schedules a one-shot task.- Parameters:
delay- Delay before task execution.runnable- Task to schedule.- Returns:
- A
GCancelableto cancel the task.
-
scheduleAtFixedRate
Schedules a task to run at a fixed delay.- Parameters:
initialDelay- Delay before task execution.period- Cadence at which tasks run.runnable- Task to schedule.- Returns:
- A
GCancelableto cancel the task.
-
scheduleWithFixedDelay
Schedules a task at a delay after each run.- Parameters:
initialDelay- Delay before task execution.delay- Delay after task execution.runnable- Task to schedule.- Returns:
- A
GCancelableto cancel the task.
-