Class SchedulerThreadPool.SchedulableTick

java.lang.Object
ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool.SchedulableTick
Enclosing class:
SchedulerThreadPool

@Deprecated public abstract static class SchedulerThreadPool.SchedulableTick extends Object
Deprecated.
To be replaced
Represents a tickable task that can be scheduled into a SchedulerThreadPool.

A tickable task is expected to run on a fixed interval, which is determined by the SchedulerThreadPool.

A tickable task can have intermediate tasks that can be executed before its tick method is ran. Instead of the SchedulerThreadPool parking in-between ticks, the scheduler will instead drain intermediate tasks from scheduled tasks. The parsing of intermediate tasks allows the scheduler to take advantage of downtime to reduce the intermediate task load from tasks once they begin ticking.

It is guaranteed that runTick() and runTasks(BooleanSupplier) are never invoked in parallel. It is required that when intermediate tasks are scheduled, that SchedulerThreadPool.notifyTasks(SchedulableTick) is invoked for any scheduled task - otherwise, runTasks(BooleanSupplier) may not be invoked to parse intermediate tasks.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final long
    Deprecated.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final long
    Deprecated.
     
    abstract boolean
    Deprecated.
    Returns whether this task has any intermediate tasks that can be executed.
    abstract Boolean
    Deprecated.
    Returns null if this task should not be scheduled, otherwise returns Boolean.TRUE if there are more intermediate tasks to execute and Boolean.FALSE if there are no more intermediate tasks to execute.
    abstract boolean
    Deprecated.
    Executes the tick.
    protected final void
    setScheduledStart(long value)
    Deprecated.
    If this task is scheduled, then this may only be invoked during runTick(), and runTasks(BooleanSupplier)
    Deprecated.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • id

      public final long id
      Deprecated.
  • Constructor Details

    • SchedulableTick

      public SchedulableTick()
      Deprecated.
  • Method Details

    • getScheduledStart

      protected final long getScheduledStart()
      Deprecated.
    • setScheduledStart

      protected final void setScheduledStart(long value)
      Deprecated.
      If this task is scheduled, then this may only be invoked during runTick(), and runTasks(BooleanSupplier)
    • runTick

      public abstract boolean runTick()
      Deprecated.
      Executes the tick.

      It is the callee's responsibility to invoke setScheduledStart(long) to adjust the start of the next tick.

      Returns:
      true if the task should continue to be scheduled, false otherwise.
    • hasTasks

      public abstract boolean hasTasks()
      Deprecated.
      Returns whether this task has any intermediate tasks that can be executed.
    • runTasks

      public abstract Boolean runTasks(BooleanSupplier canContinue)
      Deprecated.
      Returns null if this task should not be scheduled, otherwise returns Boolean.TRUE if there are more intermediate tasks to execute and Boolean.FALSE if there are no more intermediate tasks to execute.
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object