Class AbstractMainThreadBasedScheduler

java.lang.Object
dev.rollczi.litecommands.scheduler.AbstractMainThreadBasedScheduler
All Implemented Interfaces:
Scheduler

public abstract class AbstractMainThreadBasedScheduler extends Object implements Scheduler
  • Constructor Details

    • AbstractMainThreadBasedScheduler

      public AbstractMainThreadBasedScheduler()
  • Method Details

    • supplyLater

      public final <T> CompletableFuture<T> supplyLater(SchedulerType type, Duration delay, ThrowingSupplier<T,Throwable> supplier)
      Description copied from interface: Scheduler
      Runs the supplier in the specified thread after the specified delay
      Specified by:
      supplyLater in interface Scheduler
      Type Parameters:
      T - the supplier return type
      Parameters:
      type - the thread type
      delay - the delay
      supplier - the supplier to run
      Returns:
      the supplier result
    • runUnknown

      protected boolean runUnknown(SchedulerType type, Duration delay, Runnable task)
      Run task with an unknown scheduler poll type
      Returns:
      true if a task was run, false otherwise
    • runSynchronous

      protected abstract void runSynchronous(Runnable task, Duration delay)
    • runAsynchronous

      protected abstract void runAsynchronous(Runnable task, Duration delay)
    • log

      protected void log(Throwable throwable)