Package io.netty.util.concurrent
Class PromiseTask<V>
java.lang.Object
io.netty.util.concurrent.AbstractFuture<V>
io.netty.util.concurrent.DefaultPromise<V>
io.netty.util.concurrent.PromiseTask<V>
- All Implemented Interfaces:
Future<V>,Promise<V>,Runnable,Future<V>,RunnableFuture<V>
- Direct Known Subclasses:
ScheduledFutureTask,UnorderedThreadPoolEventExecutor.RunnableScheduledFutureTask
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate static classNested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Runnableprivate static final Runnableprivate static final Runnableprivate ObjectFields inherited from class io.netty.util.concurrent.DefaultPromise
PROPERTY_MAX_LISTENER_STACK_DEPTH -
Constructor Summary
ConstructorsConstructorDescriptionPromiseTask(EventExecutor executor, Runnable runnable) PromiseTask(EventExecutor executor, Runnable runnable, V result) PromiseTask(EventExecutor executor, Callable<V> callable) -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(boolean mayInterruptIfRunning) If the cancellation was successful it will fail the future with aCancellationException.private booleanclearTaskAfterCompletion(boolean done, Runnable result) final booleanfinal inthashCode()voidrun()(package private) VrunTask()setFailure(Throwable cause) Marks this future as a failure and notifies all listeners.setFailureInternal(Throwable cause) setSuccess(V result) Marks this future as a success and notifies all listeners.setSuccessInternal(V result) final booleanMake this future impossible to cancel.protected final booleanprotected StringBuilderfinal booleantryFailure(Throwable cause) Marks this future as a failure and notifies all listeners.protected final booleantryFailureInternal(Throwable cause) final booleantrySuccess(V result) Marks this future as a success and notifies all listeners.protected final booleantrySuccessInternal(V result) Methods inherited from class io.netty.util.concurrent.DefaultPromise
addListener, addListeners, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, cause, checkDeadLock, executor, get, get, getNow, isCancellable, isCancelled, isDone, isSuccess, notifyListener, notifyProgressiveListeners, removeListener, removeListeners, sync, syncUninterruptibly, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.Future
exceptionNow, get, get, isCancelled, isDone, resultNow, state
-
Field Details
-
COMPLETED
-
CANCELLED
-
FAILED
-
task
-
-
Constructor Details
-
PromiseTask
PromiseTask(EventExecutor executor, Runnable runnable, V result) -
PromiseTask
PromiseTask(EventExecutor executor, Runnable runnable) -
PromiseTask
PromiseTask(EventExecutor executor, Callable<V> callable)
-
-
Method Details
-
hashCode
public final int hashCode() -
equals
-
runTask
- Throws:
Throwable
-
run
public void run()- Specified by:
runin interfaceRunnable- Specified by:
runin interfaceRunnableFuture<V>
-
clearTaskAfterCompletion
-
setFailure
Description copied from interface:PromiseMarks this future as a failure and notifies all listeners. If it is success or failed already it will throw anIllegalStateException.- Specified by:
setFailurein interfacePromise<V>- Overrides:
setFailurein classDefaultPromise<V>
-
setFailureInternal
-
tryFailure
Description copied from interface:PromiseMarks this future as a failure and notifies all listeners.- Specified by:
tryFailurein interfacePromise<V>- Overrides:
tryFailurein classDefaultPromise<V>- Returns:
trueif and only if successfully marked this future as a failure. Otherwisefalsebecause this future is already marked as either a success or a failure.
-
tryFailureInternal
-
setSuccess
Description copied from interface:PromiseMarks this future as a success and notifies all listeners. If it is success or failed already it will throw anIllegalStateException.- Specified by:
setSuccessin interfacePromise<V>- Overrides:
setSuccessin classDefaultPromise<V>
-
setSuccessInternal
-
trySuccess
Description copied from interface:PromiseMarks this future as a success and notifies all listeners.- Specified by:
trySuccessin interfacePromise<V>- Overrides:
trySuccessin classDefaultPromise<V>- Returns:
trueif and only if successfully marked this future as a success. Otherwisefalsebecause this future is already marked as either a success or a failure.
-
trySuccessInternal
-
setUncancellable
public final boolean setUncancellable()Description copied from interface:PromiseMake this future impossible to cancel.- Specified by:
setUncancellablein interfacePromise<V>- Overrides:
setUncancellablein classDefaultPromise<V>- Returns:
trueif and only if successfully marked this future as uncancellable or it is already done without being cancelled.falseif this future has been cancelled already.
-
setUncancellableInternal
protected final boolean setUncancellableInternal() -
cancel
public boolean cancel(boolean mayInterruptIfRunning) Description copied from class:DefaultPromiseIf the cancellation was successful it will fail the future with aCancellationException. -
toStringBuilder
- Overrides:
toStringBuilderin classDefaultPromise<V>
-