Package org.kingdoms.scheduler
Interface TaskScheduler
- All Known Implementing Classes:
AbstractJavaScheduler,BukkitSchedulerAdapter
public interface TaskScheduler
A scheduler for running tasks using the systems provided by the platform
-
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.default voidexecuteAsync(Runnable task) Executes a task asyncdefault voidexecuteSync(Runnable task) Executes a task syncdefault CompletableFuture<Void>voidShuts down the executor instance.voidShuts down the scheduler instance.default <T> CompletableFuture<T>supplyFuture(Callable<T> callable) sync()Gets a sync executor instancevoid
-
Method Details
-
async
Executor async()Gets an async executor instance- Returns:
- an async executor instance
-
sync
Executor sync()Gets a sync executor instance- Returns:
- a sync executor instance
-
executeAsync
Executes a task async- Parameters:
task- the task
-
executeSync
Executes a task sync- Parameters:
task- the task
-
supplyFuture
-
runFuture
-
syncLater
-
asyncLater
Executes the given task with a delay.- Parameters:
task- the task- Returns:
- the resultant task instance
-
asyncRepeating
Executes the given task repeatedly at a given interval.- Returns:
- the resultant task instance
-
shutdownScheduler
void shutdownScheduler()Shuts down the scheduler instance.asyncLater(Duration, Runnable)andasyncRepeating(Duration, Duration, Runnable). -
shutdownExecutor
void shutdownExecutor()Shuts down the executor instance.
-