Package org.kingdoms.scheduler
Class AbstractJavaScheduler
java.lang.Object
org.kingdoms.scheduler.AbstractJavaScheduler
- All Implemented Interfaces:
TaskScheduler
- Direct Known Subclasses:
BukkitSchedulerAdapter
Abstract implementation of
TaskScheduler using a ScheduledExecutorService.-
Constructor Summary
ConstructorsConstructorDescriptionAbstractJavaScheduler(org.kingdoms.dependencies.classpath.BootstrapProvider bootstrap) -
Method Summary
Modifier and TypeMethodDescriptionasync()Gets an async executor instanceasyncLater(Duration delay, Runnable task) Executes the given task with a delay.asyncRepeating(Duration initialDelay, Duration interval, Runnable task) Executes the given task repeatedly at a given interval.voidShuts down the executor instance.voidShuts down the scheduler instance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.kingdoms.scheduler.TaskScheduler
executeAsync, executeSync, runFuture, supplyFuture, sync, syncLater
-
Constructor Details
-
AbstractJavaScheduler
public AbstractJavaScheduler(org.kingdoms.dependencies.classpath.BootstrapProvider bootstrap)
-
-
Method Details
-
async
Description copied from interface:TaskSchedulerGets an async executor instance- Specified by:
asyncin interfaceTaskScheduler- Returns:
- an async executor instance
-
asyncLater
Description copied from interface:TaskSchedulerExecutes the given task with a delay.- Specified by:
asyncLaterin interfaceTaskSchedulertask- the task- Returns:
- the resultant task instance
-
asyncRepeating
Description copied from interface:TaskSchedulerExecutes the given task repeatedly at a given interval.- Specified by:
asyncRepeatingin interfaceTaskScheduler- Returns:
- the resultant task instance
-
shutdownScheduler
public void shutdownScheduler()Description copied from interface:TaskSchedulerShuts down the scheduler instance.TaskScheduler.asyncLater(Duration, Runnable)andTaskScheduler.asyncRepeating(Duration, Duration, Runnable).- Specified by:
shutdownSchedulerin interfaceTaskScheduler
-
shutdownExecutor
public void shutdownExecutor()Description copied from interface:TaskSchedulerShuts down the executor instance.TaskScheduler.async()andTaskScheduler.executeAsync(Runnable).- Specified by:
shutdownExecutorin interfaceTaskScheduler
-