Package top.focess.qq.api.schedule
Interface Scheduler
-
- All Known Implementing Classes:
AScheduler,FocessScheduler,ThreadPoolScheduler
public interface SchedulerUsed to schedule task
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidcancelAll()Cancel all the tasksvoidclose()Close this schedulervoidcloseNow()Close this scheduler even if there are tasks runningStringgetName()Get the name of the schedulerPlugingetPlugin()Get the pluginbooleanisClosed()Indicate whether this scheduler is closed or notdefault Taskrun(Runnable runnable)Run a task nowTaskrun(Runnable runnable, java.time.Duration delay)Run a task laterTaskrunTimer(Runnable runnable, java.time.Duration delay, java.time.Duration period)Run a task timerdefault <V> Callback<V>submit(Callable<V> callable)Submit a task now<V> Callback<V>submit(Callable<V> callable, java.time.Duration delay)Submit a task later
-
-
-
Method Detail
-
run
default Task run(Runnable runnable)
Run a task now- Parameters:
runnable- the task- Returns:
- the warped task
-
run
Task run(Runnable runnable, java.time.Duration delay)
Run a task later- Parameters:
runnable- the taskdelay- the delay- Returns:
- the warped task
-
runTimer
Task runTimer(Runnable runnable, java.time.Duration delay, java.time.Duration period)
Run a task timer- Parameters:
runnable- the taskdelay- the delayperiod- the period- Returns:
- the warped task
-
submit
default <V> Callback<V> submit(Callable<V> callable)
Submit a task now- Type Parameters:
V- the return type- Parameters:
callable- the task- Returns:
- the warped task
-
submit
<V> Callback<V> submit(Callable<V> callable, java.time.Duration delay)
Submit a task later- Type Parameters:
V- the return type- Parameters:
callable- the taskdelay- the delay- Returns:
- the warped task
-
cancelAll
void cancelAll()
Cancel all the tasks
-
getName
String getName()
Get the name of the scheduler- Returns:
- the name of the scheduler
-
getPlugin
Plugin getPlugin()
Get the plugin- Returns:
- the plugin
-
close
void close()
Close this scheduler
-
isClosed
boolean isClosed()
Indicate whether this scheduler is closed or not- Returns:
- true if this scheduler is closed, false otherwise
-
closeNow
void closeNow()
Close this scheduler even if there are tasks running
-
-