public class DefaultChannelPromise extends DefaultPromise<java.lang.Void> implements ChannelPromise
ChannelPromise implementation. It is recommended to use Channel.newPromise() to create
a new ChannelPromise rather than calling the constructor explicitly.| Constructor and Description |
|---|
DefaultChannelPromise (Channel channel)
Creates a new instance.
|
DefaultChannelPromise (Channel channel,
EventExecutor executor)
Creates a new instance.
|
| Modifier and Type | Method and 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.
|
protected void |
checkDeadLock () |
protected EventExecutor |
executor ()
Get the executor used to notify listeners when this promise is complete.
|
long |
flushCheckpoint () |
void |
flushCheckpoint (long checkpoint) |
ChannelPromise |
promise () |
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 () |
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, getNow, isCancellable, isCancelled, isDone, isSuccess, notifyListener, setUncancellable, toString, toStringBuilder, tryFailure, trySuccess get, get clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitsetUncancellable, tryFailure, trySuccess await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, getNow, isCancellable, isSuccess get, get, isCancelled, isDonepublic DefaultChannelPromise(Channel channel)
channel - the Channel associated with this futurepublic DefaultChannelPromise(Channel channel, EventExecutor executor)
channel - the Channel associated with this futureprotected EventExecutor executor()
DefaultPromise
It is assumed this executor will protect against StackOverflowError exceptions.
The executor may be used to avoid StackOverflowError by executing a Runnable if the stack
depth exceeds a threshold.
executor in class DefaultPromise<java.lang.Void>public Channel channel()
ChannelFuture channel in interface ChannelFuture channel in interface ChannelPromise public ChannelPromise setSuccess()
setSuccess in interface ChannelPromise public ChannelPromise setSuccess(java.lang.Void result)
Promise IllegalStateException.setSuccess in interface ChannelPromise setSuccess in interface Promise<java.lang.Void>setSuccess in class DefaultPromise<java.lang.Void>public boolean trySuccess()
trySuccess in interface ChannelPromise public ChannelPromise setFailure(java.lang.Throwable cause)
Promise IllegalStateException.setFailure in interface ChannelPromise setFailure in interface Promise<java.lang.Void>setFailure in class DefaultPromise<java.lang.Void>public ChannelPromise addListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Future addListener in interface ChannelFuture addListener in interface ChannelPromise addListener in interface Promise<java.lang.Void>addListener in class DefaultPromise<java.lang.Void>public ChannelPromise addListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Future addListeners in interface ChannelFuture addListeners in interface ChannelPromise addListeners in interface Promise<java.lang.Void>addListeners in class DefaultPromise<java.lang.Void>public ChannelPromise removeListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Future removeListener in interface ChannelFuture removeListener in interface ChannelPromise removeListener in interface Promise<java.lang.Void>removeListener in class DefaultPromise<java.lang.Void>public ChannelPromise removeListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Future removeListeners in interface ChannelFuture removeListeners in interface ChannelPromise removeListeners in interface Promise<java.lang.Void>removeListeners in class DefaultPromise<java.lang.Void>public ChannelPromise sync() throws java.lang.InterruptedException
Future sync in interface ChannelFuture sync in interface ChannelPromise sync in interface Promise<java.lang.Void>sync in class DefaultPromise<java.lang.Void>java.lang.InterruptedExceptionpublic ChannelPromise syncUninterruptibly()
Future syncUninterruptibly in interface ChannelFuture syncUninterruptibly in interface ChannelPromise syncUninterruptibly in interface Promise<java.lang.Void>syncUninterruptibly in class DefaultPromise<java.lang.Void>public ChannelPromise await() throws java.lang.InterruptedException
Future await in interface ChannelFuture await in interface ChannelPromise await in interface Promise<java.lang.Void>await in class DefaultPromise<java.lang.Void>java.lang.InterruptedException - if the current thread was interruptedpublic ChannelPromise awaitUninterruptibly()
Future InterruptedException and
discards it silently.awaitUninterruptibly in interface ChannelFuture awaitUninterruptibly in interface ChannelPromise awaitUninterruptibly in interface Promise<java.lang.Void>awaitUninterruptibly in class DefaultPromise<java.lang.Void>public long flushCheckpoint()
public void flushCheckpoint(long checkpoint)
public ChannelPromise promise()
protected void checkDeadLock()
checkDeadLock in class DefaultPromise<java.lang.Void>Copyright © 2008–2018 The Netty Project. All rights reserved.