- All Superinterfaces:
Executor,TickAdapter
- All Known Subinterfaces:
AsyncExecutor,SyncExecutor
- All Known Implementing Classes:
AbstractSyncExecutor,SimpleAsyncExecutor
Represents a task executor.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidbooleanisValid()Check whether this executor can currently schedule and execute tasks.default TaskSchedule a repeating task.Schedule a repeating task.Schedule a repeating task.default TaskSchedule a repeating task.voidshutdown()Safely shutdown this executor.default CompletableFuture<?>Submit a task.default CompletableFuture<?>Submit a task.default CompletableFuture<?>Submit a task.default <V> CompletableFuture<@PolyNull V>Submit a task.<V> CompletableFuture<@PolyNull V>Submit a task.<V> CompletableFuture<@PolyNull V>Submit a task.Methods inherited from interface me.moros.tasker.executor.TickAdapter
convert, toMillis, toTicks
-
Method Details
-
execute
-
submit
Submit a task.- Parameters:
task- the task to submit- Returns:
- the scheduled task
-
submit
Submit a task.- Type Parameters:
V- the type of result the task returns- Parameters:
task- the task to submit- Returns:
- the scheduled task as a future
-
submit
Submit a task.- Parameters:
task- the task to submitticks- the delay before the task is executed in game ticks- Returns:
- the scheduled task as a future
-
submit
Submit a task.- Type Parameters:
V- the type of result the task returns- Parameters:
task- the task to submitticks- the delay before the task is executed in game ticks- Returns:
- the scheduled task as a future
-
submit
Submit a task.- Parameters:
task- the task to submitdelay- the delay before the task is executedunit- the unit of time for delay- Returns:
- the scheduled task as a future
-
submit
Submit a task.- Type Parameters:
V- the type of result the task returns- Parameters:
task- the task to submitdelay- the delay before the task is executedunit- the unit of time for delay- Returns:
- the scheduled task as a future
-
repeat
Schedule a repeating task.- Parameters:
task- the task to scheduleperiodTicks- how often to repeat the task in game ticks- Returns:
- the scheduled task
-
repeat
Schedule a repeating task.- Parameters:
task- the task to scheduleperiod- how often to repeat the taskunit- the unit of time for period- Returns:
- the scheduled task
-
repeat
Schedule a repeating task.- Parameters:
task- the task to scheduleticks- the delay before the first task execution in game ticksperiodTicks- how often to repeat the task in game ticks- Returns:
- the scheduled task
-
repeat
Schedule a repeating task.- Parameters:
task- the task to scheduledelay- the delay before the first task executionperiod- how often to repeat the taskunit- the unit of time for delay and period- Returns:
- the scheduled task
-
isValid
boolean isValid()Check whether this executor can currently schedule and execute tasks. This should return false if it hasn't been initialized or has been terminated.- Returns:
- whether tasks can be scheduled and executed
-
shutdown
void shutdown()Safely shutdown this executor.
-