Class AbstractTask<T>

java.lang.Object
dev.upcraft.sparkweave.impl.scheduler.AbstractTask<T>
All Implemented Interfaces:
Task<T>
Direct Known Subclasses:
RepeatingTask, SingleRunTask

public abstract class AbstractTask<T> extends Object implements Task<T>
  • Field Details

    • task

      protected final Callable<T> task
    • nextExecutionTime

      protected long nextExecutionTime
  • Constructor Details

    • AbstractTask

      public AbstractTask(long nextExecutionTime, Callable<T> task)
  • Method Details

    • nextExecutionTime

      public long nextExecutionTime()
    • run

      public abstract boolean run(LongSupplier timeSupplier)
    • getLastResult

      public com.mojang.datafixers.util.Either<T,? extends Exception> getLastResult()
      Specified by:
      getLastResult in interface Task<T>
      Returns:
      the last result of this task, or an exception if the task failed.
    • cancel

      public void cancel()
      Description copied from interface: Task
      Cancel any future execution of this task. If the task is currently running, it will be allowed to finish.

      Repeatedly calling this method has no effect.

      Specified by:
      cancel in interface Task<T>
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface Task<T>