Class AsyncBiLateScheduler<A,​B>

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

public final class AsyncBiLateScheduler<A,​B> extends Object implements BiLateScheduler<A,​B>
This scheduler will run a task when X is completed
  • Constructor Details

    • AsyncBiLateScheduler

      public AsyncBiLateScheduler()
  • Method Details

    • whenComplete

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

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

      public BiLateScheduler<A,​B> whenComplete(TriConsumer<A,​B,​Throwable> caughtAction)
      Set the complete action
      Specified by:
      whenComplete in interface BiLateScheduler<A,​B>
      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 BiLateScheduler<A,​B>
      Returns:
      if the scheduler is complete
    • getObject

      public A getObject()
      Get the A object
      Specified by:
      getObject in interface BiLateScheduler<A,​B>
      Returns:
      the A object
    • getSubObject

      public B getSubObject()
      Get the B object
      Specified by:
      getSubObject in interface BiLateScheduler<A,​B>
      Returns:
      the B object
    • complete

      public void complete(A target, B subTarget)
      Complete the scheduler
      Specified by:
      complete in interface BiLateScheduler<A,​B>
      Parameters:
      target - the type A object
      subTarget - the type B object
    • complete

      public void complete(A target, B subTarget, Throwable error)
      Complete the scheduler
      Specified by:
      complete in interface BiLateScheduler<A,​B>
      Parameters:
      target - the type A object
      subTarget - the type B 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