Class DefaultTickLoop.ScheduledTask<T>

java.lang.Object
java.util.concurrent.CompletableFuture<T>
eu.cloudnetservice.utils.base.concurrent.ListenableTask<T>
eu.cloudnetservice.node.impl.tick.DefaultTickLoop.ScheduledTask<T>
All Implemented Interfaces:
CompletionStage<T>, Future<T>
Enclosing class:
DefaultTickLoop

private static final class DefaultTickLoop.ScheduledTask<T> extends eu.cloudnetservice.utils.base.concurrent.ListenableTask<T>
  • Field Details

    • tickPeriod

      private final long tickPeriod
      The number of ticks between each call of this task.
    • executionTimes

      private final long executionTimes
      The number of times this task should execute.
    • executionCounter

      private long executionCounter
      The counter keeping track of the number of times this task was executed
    • nextScheduledTick

      private long nextScheduledTick
      The next tick this task is about to execute.
  • Constructor Details

    • ScheduledTask

      public ScheduledTask(@NonNull @NonNull Callable<T> callable, long tickPeriod, long executionTimes, long nextScheduledTick)
  • Method Details

    • execute

      private boolean execute(long currentTick)
      Executes this task and resets the future to prepare for the next execution.
      Parameters:
      currentTick - the current tick number.
      Returns:
      true if this task terminated and should be unregistered after the execution, false otherwise.