Package top.focess.qq.api.schedule
Interface Callback<V>
-
- Type Parameters:
V- the target value type
- All Known Implementing Classes:
FocessCallback
public interface Callback<V> extends Task, Future<V>
The warped task. You can use this to handle callable processing
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Vcall()Call the target valuedefault Vget()Wait for this task finished and call the target valueVget(long timeout, TimeUnit unit)Wait for the time and call the target valuedefault booleanisDone()Indicate whether this task is done or notdefault VwaitCall()Wait for this task finished and call the target value-
Methods inherited from interface java.util.concurrent.Future
cancel, isCancelled
-
Methods inherited from interface top.focess.qq.api.schedule.Task
cancel, cancel, getName, getPlugin, getScheduler, isCancelled, isFinished, isPeriod, isRunning
-
-
-
-
Method Detail
-
call
V call() throws ExecutionException, CancellationException, TaskNotFinishedException
Call the target value- Returns:
- the target value
- Throws:
CancellationException- if the task is cancelledTaskNotFinishedException- if the task is not finishedExecutionException- if there is any exception in the execution processing
-
waitCall
default V waitCall() throws InterruptedException, ExecutionException
Wait for this task finished and call the target value- Returns:
- the target value
- Throws:
InterruptedException- if the current thread was interrupted while waitingExecutionException- if there is any exception in the execution processing
-
isDone
default boolean isDone()
Indicate whether this task is done or not- Specified by:
isDonein interfaceFuture<V>- Returns:
- true if this task is finished, false otherwise
- See Also:
Task.isFinished()
-
get
default V get() throws InterruptedException, ExecutionException
Wait for this task finished and call the target value- Specified by:
getin interfaceFuture<V>- Returns:
- the target value
- Throws:
InterruptedException- if the current thread was interrupted while waitingExecutionException- if there is any exception in the execution processing- See Also:
waitCall()
-
get
V get(long timeout, @NotNull TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException, CancellationException
Wait for the time and call the target value- Specified by:
getin interfaceFuture<V>- Parameters:
timeout- the timeoutunit- the time unit- Returns:
- the target value
- Throws:
InterruptedException- if the current thread was interrupted while waitingExecutionException- if there is any exception in the execution processingTimeoutException- if the time is outCancellationException- if the task is cancelled
-
-