Package io.netty.util.concurrent
Interface Promise<V>
- All Known Subinterfaces:
ChannelProgressivePromise
,ChannelPromise
,ProgressivePromise<V>
- All Known Implementing Classes:
AbstractBootstrap.PendingRegistrationPromise
,AbstractChannel.CloseFuture
,DefaultChannelGroupFuture
,DefaultChannelProgressivePromise
,DefaultChannelPromise
,DefaultProgressivePromise
,DefaultPromise
,DelegatingChannelPromiseNotifier
,Http2CodecUtil.SimpleChannelPromiseAggregator
,ImmediateEventExecutor.ImmediateProgressivePromise
,ImmediateEventExecutor.ImmediatePromise
,PromiseTask
,ProxyHandler.LazyChannelPromise
,ScheduledFutureTask
,SslHandler.LazyChannelPromise
,UnorderedThreadPoolEventExecutor.RunnableScheduledFutureTask
,VoidChannelPromise
Special
Future
which is writable.-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Method Summary
Modifier and TypeMethodDescriptionaddListener
(GenericFutureListener<? extends Future<? super V>> listener) Adds the specified listener to this future.addListeners
(GenericFutureListener<? extends Future<? super V>>... listeners) Adds the specified listeners to this future.await()
Waits for this future to be completed.Waits for this future to be completed without interruption.removeListener
(GenericFutureListener<? extends Future<? super V>> listener) Removes the first occurrence of the specified listener from this future.removeListeners
(GenericFutureListener<? extends Future<? super V>>... listeners) Removes the first occurrence for each of the listeners from this future.setFailure
(Throwable cause) Marks this future as a failure and notifies all listeners.setSuccess
(V result) Marks this future as a success and notifies all listeners.boolean
Make this future impossible to cancel.sync()
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.Waits for this future until it is done, and rethrows the cause of the failure if this future failed.boolean
tryFailure
(Throwable cause) Marks this future as a failure and notifies all listeners.boolean
trySuccess
(V result) Marks this future as a success and notifies all listeners.Methods inherited from interface io.netty.util.concurrent.Future
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, getNow, isCancellable, isSuccess
Methods inherited from interface java.util.concurrent.Future
exceptionNow, get, get, isCancelled, isDone, resultNow, state
-
Method Details
-
setSuccess
Marks this future as a success and notifies all listeners. If it is success or failed already it will throw anIllegalStateException
. -
trySuccess
Marks this future as a success and notifies all listeners.- Returns:
true
if and only if successfully marked this future as a success. Otherwisefalse
because this future is already marked as either a success or a failure.
-
setFailure
Marks this future as a failure and notifies all listeners. If it is success or failed already it will throw anIllegalStateException
. -
tryFailure
Marks this future as a failure and notifies all listeners.- Returns:
true
if and only if successfully marked this future as a failure. Otherwisefalse
because this future is already marked as either a success or a failure.
-
setUncancellable
boolean setUncancellable()Make this future impossible to cancel.- Returns:
true
if and only if successfully marked this future as uncancellable or it is already done without being cancelled.false
if this future has been cancelled already.
-
addListener
Description copied from interface:Future
Adds the specified listener to this future. The specified listener is notified when this future is done. If this future is already completed, the specified listener is notified immediately.- Specified by:
addListener
in interfaceFuture<V>
-
addListeners
Description copied from interface:Future
Adds the specified listeners to this future. The specified listeners are notified when this future is done. If this future is already completed, the specified listeners are notified immediately.- Specified by:
addListeners
in interfaceFuture<V>
-
removeListener
Description copied from interface:Future
Removes the first occurrence of the specified listener from this future. The specified listener is no longer notified when this future is done. If the specified listener is not associated with this future, this method does nothing and returns silently.- Specified by:
removeListener
in interfaceFuture<V>
-
removeListeners
Description copied from interface:Future
Removes the first occurrence for each of the listeners from this future. The specified listeners are no longer notified when this future is done. If the specified listeners are not associated with this future, this method does nothing and returns silently.- Specified by:
removeListeners
in interfaceFuture<V>
-
await
Description copied from interface:Future
Waits for this future to be completed.- Specified by:
await
in interfaceFuture<V>
- Throws:
InterruptedException
- if the current thread was interrupted
-
awaitUninterruptibly
Description copied from interface:Future
Waits for this future to be completed without interruption. This method catches anInterruptedException
and discards it silently.- Specified by:
awaitUninterruptibly
in interfaceFuture<V>
-
sync
Description copied from interface:Future
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.- Specified by:
sync
in interfaceFuture<V>
- Throws:
InterruptedException
-
syncUninterruptibly
Description copied from interface:Future
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.- Specified by:
syncUninterruptibly
in interfaceFuture<V>
-