Class TaskScheduler.TimerTask

All Implemented Interfaces:
Comparable<Task>, Runnable, Task
Enclosing class:
TaskScheduler

public class TaskScheduler.TimerTask extends LambdaTask
Represents a task managed by a TaskScheduler.
  • Method Details

    • cancel

      public boolean cancel()
      Cancels this task. Equivalent to a call to:
       taskScheduler.clear(this)
       
      where taskScheduler is the TaskScheduler that created this TaskScheduler.TimerTask.
      Returns:
      true if the task was found and successfully canceled
      Since:
      2.6
      See Also:
    • daemon

      public TaskScheduler.TimerTask daemon()
      Marks this task as a daemon task. If a task is a daemon task, it will not prevent the TaskScheduler from exiting.
      Returns:
      This instance
      See Also:
    • undaemon

      public TaskScheduler.TimerTask undaemon()
      Marks this task as a non-daemon task. Queued non-daemon tasks prevent the TaskScheduler from exiting.
      Returns:
      This instance
      See Also:
    • getId

      public long getId()
      Returns the TaskScheduler-instance-wide unique ID of this TaskScheduler.TimerTask.
      Returns:
      The ID
    • getTime

      public long getTime()
      Returns the absolute time in nanoseconds when this task is scheduled to run.
      Returns:
      The absolute time
    • getPeriod

      public long getPeriod()
      Returns the interval in nanoseconds between running this task. This value is 0 for a one-time task.
      Returns:
      The interval period
    • isDaemon

      public boolean isDaemon()
      Returns true if this task was defined as a daemon task.
      Returns:
      Whether this task was defined as a daemon task
      See Also:
    • isCanceled

      public boolean isCanceled()
      Returns true if this task is canceled.
      Returns:
      Whether this task is canceled