Package top.focess.qq.api.schedule
Interface Task
-
- All Known Subinterfaces:
Callback<V>
- All Known Implementing Classes:
FocessCallback,FocessTask
public interface TaskThe warped task. You can use this to handle runnable processing
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleancancel()Cancel this taskbooleancancel(boolean mayInterruptIfRunning)Cancel this taskStringgetName()Get the name of the taskPlugingetPlugin()Get the plugin it belongs toSchedulergetScheduler()Get the scheduler it belongs tobooleanisCancelled()Indicate whether this task is cancelled or notbooleanisFinished()Indicate whether this task is finished or notbooleanisPeriod()Indicate whether this task is a period-task or notbooleanisRunning()Indicate whether this task is running or notvoidjoin()wait until this task is finished
-
-
-
Method Detail
-
cancel
boolean cancel(boolean mayInterruptIfRunning)
Cancel this task- Parameters:
mayInterruptIfRunning- must be false- Returns:
- true if it is cancelled, false it cannot be cancelled or it is already cancelled
-
cancel
default boolean cancel()
Cancel this task- Returns:
- true if it is cancelled, false it cannot be cancelled or it is already cancelled
- See Also:
cancel(boolean)
-
isRunning
boolean isRunning()
Indicate whether this task is running or not- Returns:
- true if the task is running, false otherwise
-
getPlugin
Plugin getPlugin()
Get the plugin it belongs to- Returns:
- the plugin it belongs to
-
getScheduler
Scheduler getScheduler()
Get the scheduler it belongs to- Returns:
- the scheduler it belongs to
-
getName
String getName()
Get the name of the task- Returns:
- the name of the task
-
isPeriod
boolean isPeriod()
Indicate whether this task is a period-task or not- Returns:
- true if it is a period-task, false otherwise
-
isFinished
boolean isFinished()
Indicate whether this task is finished or not- Returns:
- true if this task is finished, false otherwise
-
isCancelled
boolean isCancelled()
Indicate whether this task is cancelled or not- Returns:
- true if it is cancelled, false otherwise
-
join
void join() throws ExecutionException, InterruptedException, CancellationException
wait until this task is finished- Throws:
ExecutionException- if there is any exception in the execution processingInterruptedException- if the task is interruptedCancellationException- if the task is cancelled
-
-