Interface GTaskScheduler

All Superinterfaces:
Executor
All Known Implementing Classes:
GTaskSchedulerService

public interface GTaskScheduler extends Executor
A scheduler utility on top of ScheduledExecutorService.

This class standardizes the interface to use Duration for timings.

  • Method Details

    • schedule

      GCancelable schedule(Duration delay, Runnable runnable)
      Schedules a one-shot task.
      Parameters:
      delay - Delay before task execution.
      runnable - Task to schedule.
      Returns:
      A GCancelable to cancel the task.
    • scheduleAtFixedRate

      GCancelable scheduleAtFixedRate(Duration initialDelay, Duration period, Runnable runnable)
      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 GCancelable to cancel the task.
    • scheduleWithFixedDelay

      GCancelable scheduleWithFixedDelay(Duration initialDelay, Duration delay, Runnable runnable)
      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 GCancelable to cancel the task.