Package io.netty.channel
Interface ChannelPromise
- All Known Subinterfaces:
ChannelProgressivePromise
- All Known Implementing Classes:
AbstractBootstrap.PendingRegistrationPromise
,AbstractChannel.CloseFuture
,DefaultChannelProgressivePromise
,DefaultChannelPromise
,DelegatingChannelPromiseNotifier
,Http2CodecUtil.SimpleChannelPromiseAggregator
,VoidChannelPromise
Special
ChannelFuture
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 Void>> listener) Adds the specified listener to this future.addListeners
(GenericFutureListener<? extends Future<? super Void>>... 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.channel()
Returns a channel where the I/O operation associated with this future takes place.removeListener
(GenericFutureListener<? extends Future<? super Void>> listener) Removes the first occurrence of the specified listener from this future.removeListeners
(GenericFutureListener<? extends Future<? super Void>>... 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
(Void result) Marks this future as a success and notifies all listeners.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
unvoid()
Methods inherited from interface io.netty.channel.ChannelFuture
isVoid
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
Methods inherited from interface io.netty.util.concurrent.Promise
setUncancellable, tryFailure, trySuccess
-
Method Details
-
channel
Channel channel()Description copied from interface:ChannelFuture
Returns a channel where the I/O operation associated with this future takes place.- Specified by:
channel
in interfaceChannelFuture
-
setSuccess
Description copied from interface:Promise
Marks this future as a success and notifies all listeners. If it is success or failed already it will throw anIllegalStateException
.- Specified by:
setSuccess
in interfacePromise<Void>
-
setSuccess
ChannelPromise setSuccess() -
trySuccess
boolean trySuccess() -
setFailure
Description copied from interface:Promise
Marks this future as a failure and notifies all listeners. If it is success or failed already it will throw anIllegalStateException
.- Specified by:
setFailure
in interfacePromise<Void>
-
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 interfaceChannelFuture
- Specified by:
addListener
in interfaceFuture<Void>
- Specified by:
addListener
in interfacePromise<Void>
-
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 interfaceChannelFuture
- Specified by:
addListeners
in interfaceFuture<Void>
- Specified by:
addListeners
in interfacePromise<Void>
-
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 interfaceChannelFuture
- Specified by:
removeListener
in interfaceFuture<Void>
- Specified by:
removeListener
in interfacePromise<Void>
-
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 interfaceChannelFuture
- Specified by:
removeListeners
in interfaceFuture<Void>
- Specified by:
removeListeners
in interfacePromise<Void>
-
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 interfaceChannelFuture
- Specified by:
sync
in interfaceFuture<Void>
- Specified by:
sync
in interfacePromise<Void>
- Throws:
InterruptedException
-
syncUninterruptibly
ChannelPromise 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 interfaceChannelFuture
- Specified by:
syncUninterruptibly
in interfaceFuture<Void>
- Specified by:
syncUninterruptibly
in interfacePromise<Void>
-
await
Description copied from interface:Future
Waits for this future to be completed.- Specified by:
await
in interfaceChannelFuture
- Specified by:
await
in interfaceFuture<Void>
- Specified by:
await
in interfacePromise<Void>
- Throws:
InterruptedException
- if the current thread was interrupted
-
awaitUninterruptibly
ChannelPromise 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 interfaceChannelFuture
- Specified by:
awaitUninterruptibly
in interfaceFuture<Void>
- Specified by:
awaitUninterruptibly
in interfacePromise<Void>
-
unvoid
ChannelPromise unvoid()
-