Class FixedLateScheduler<A>

java.lang.Object
ml.karmaconfigs.api.common.timer.scheduler.worker.FixedLateScheduler<A>
Type Parameters:
A - the A object consumer
All Implemented Interfaces:
CancellableScheduler, LateScheduler<A>

public final class FixedLateScheduler<A> extends Object implements LateScheduler<A>
This scheduler will run a task when X is completed
  • Constructor Details

    • FixedLateScheduler

      public FixedLateScheduler()
  • Method Details

    • whenComplete

      public LateScheduler<A> whenComplete(Runnable action)
      Set the complete action
      Specified by:
      whenComplete in interface LateScheduler<A>
      Parameters:
      action - the action to perform when the scheduler is completed
      Returns:
      this instance
    • whenComplete

      public LateScheduler<A> whenComplete(Consumer<A> action)
      Set the complete action
      Specified by:
      whenComplete in interface LateScheduler<A>
      Parameters:
      action - the action to perform when the scheduler is completed
      Returns:
      this instance
    • whenComplete

      public LateScheduler<A> whenComplete(BiConsumer<A,​Throwable> caughtAction)
      Set the complete action
      Specified by:
      whenComplete in interface LateScheduler<A>
      Parameters:
      caughtAction - the action to perform when the scheduler is completed
      Returns:
      this instance
    • isCompleted

      public boolean isCompleted()
      Get if the scheduler is completed
      Specified by:
      isCompleted in interface LateScheduler<A>
      Returns:
      if the shcheduler is complete
    • get

      public A get()
      Get the A object
      Specified by:
      get in interface LateScheduler<A>
      Returns:
      the A object
    • complete

      public void complete(A target)
      Complete the scheduler
      Specified by:
      complete in interface LateScheduler<A>
      Parameters:
      target - the type A object
    • complete

      public void complete(A target, Throwable error)
      Complete the scheduler
      Specified by:
      complete in interface LateScheduler<A>
      Parameters:
      target - the type A object
      error - any error that has been thrown
    • whenCancelled

      public CancellableScheduler whenCancelled(Runnable action)
      Set the cancelled action
      Specified by:
      whenCancelled in interface CancellableScheduler
      Parameters:
      action - the action to perform when the timer is cancelled
      Returns:
      a cancellable instance of this
    • isCancelled

      public boolean isCancelled()
      Get if the scheduler is cancelled
      Specified by:
      isCancelled in interface CancellableScheduler
      Returns:
      if the scheduler is cancelled
    • setCancelled

      public void setCancelled()
      Cancel the scheduler
      Specified by:
      setCancelled in interface CancellableScheduler