Package io.netty.channel
Interface ChannelPromise
-
- All Superinterfaces:
ChannelFuture
,Future<java.lang.Void>
,java.util.concurrent.Future<java.lang.Void>
,Promise<java.lang.Void>
- All Known Subinterfaces:
ChannelProgressivePromise
- All Known Implementing Classes:
DefaultChannelProgressivePromise
,DefaultChannelPromise
,DelegatingChannelPromiseNotifier
,VoidChannelPromise
public interface ChannelPromise extends ChannelFuture, Promise<java.lang.Void>
SpecialChannelFuture
which is writable.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ChannelPromise
addListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Adds the specified listener to this future.ChannelPromise
addListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Adds the specified listeners to this future.ChannelPromise
await()
Waits for this future to be completed.ChannelPromise
awaitUninterruptibly()
Waits for this future to be completed without interruption.Channel
channel()
Returns a channel where the I/O operation associated with this future takes place.ChannelPromise
removeListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Removes the first occurrence of the specified listener from this future.ChannelPromise
removeListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Removes the first occurrence for each of the listeners from this future.ChannelPromise
setFailure(java.lang.Throwable cause)
Marks this future as a failure and notifies all listeners.ChannelPromise
setSuccess()
ChannelPromise
setSuccess(java.lang.Void result)
Marks this future as a success and notifies all listeners.ChannelPromise
sync()
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.ChannelPromise
syncUninterruptibly()
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.boolean
trySuccess()
ChannelPromise
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 io.netty.util.concurrent.Promise
setUncancellable, tryFailure, trySuccess
-
-
-
-
Method Detail
-
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
ChannelPromise setSuccess(java.lang.Void result)
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<java.lang.Void>
-
setSuccess
ChannelPromise setSuccess()
-
trySuccess
boolean trySuccess()
-
setFailure
ChannelPromise setFailure(java.lang.Throwable cause)
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<java.lang.Void>
-
addListener
ChannelPromise addListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
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<java.lang.Void>
- Specified by:
addListener
in interfacePromise<java.lang.Void>
-
addListeners
ChannelPromise addListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
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<java.lang.Void>
- Specified by:
addListeners
in interfacePromise<java.lang.Void>
-
removeListener
ChannelPromise removeListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
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<java.lang.Void>
- Specified by:
removeListener
in interfacePromise<java.lang.Void>
-
removeListeners
ChannelPromise removeListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
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<java.lang.Void>
- Specified by:
removeListeners
in interfacePromise<java.lang.Void>
-
sync
ChannelPromise sync() throws java.lang.InterruptedException
Description copied from interface:Future
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
-
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<java.lang.Void>
- Specified by:
syncUninterruptibly
in interfacePromise<java.lang.Void>
-
await
ChannelPromise await() throws java.lang.InterruptedException
Description copied from interface:Future
Waits for this future to be completed.
-
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<java.lang.Void>
- Specified by:
awaitUninterruptibly
in interfacePromise<java.lang.Void>
-
unvoid
ChannelPromise unvoid()
-
-