@UnstableApi public final class DelegatingChannelPromiseNotifier extends java.lang.Object implements ChannelPromise, ChannelFutureListener
CLOSE, CLOSE_ON_FAILURE, FIRE_EXCEPTION_ON_FAILURE
构造器和说明 |
---|
DelegatingChannelPromiseNotifier(ChannelPromise delegate) |
DelegatingChannelPromiseNotifier(ChannelPromise delegate,
boolean logNotifyFailure) |
限定符和类型 | 方法和说明 |
---|---|
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.
|
boolean |
await(long timeoutMillis)
Waits for this future to be completed within the
specified time limit.
|
boolean |
await(long timeout,
java.util.concurrent.TimeUnit unit)
Waits for this future to be completed within the
specified time limit.
|
ChannelPromise |
awaitUninterruptibly()
Waits for this future to be completed without
interruption.
|
boolean |
awaitUninterruptibly(long timeoutMillis)
Waits for this future to be completed within the
specified time limit without interruption.
|
boolean |
awaitUninterruptibly(long timeout,
java.util.concurrent.TimeUnit unit)
Waits for this future to be completed within the
specified time limit without interruption.
|
boolean |
cancel(boolean mayInterruptIfRunning)
If the cancellation was successful it will fail the future with a
CancellationException . |
java.lang.Throwable |
cause()
Returns the cause of the failed I/O operation if the I/O operation has
failed.
|
Channel |
channel()
Returns a channel where the I/O operation associated with this
future takes place.
|
java.lang.Void |
get() |
java.lang.Void |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
java.lang.Void |
getNow()
Return the result without blocking.
|
boolean |
isCancellable()
returns
true if and only if the operation can be cancelled via Future.cancel(boolean) . |
boolean |
isCancelled() |
boolean |
isDone() |
boolean |
isSuccess()
Returns
true if and only if the I/O operation was completed
successfully. |
boolean |
isVoid()
Returns
true if this ChannelFuture is a void future and so not allow to call any of the
following methods:
ChannelFuture.addListener(GenericFutureListener)
ChannelFuture.addListeners(GenericFutureListener[])
ChannelFuture.await()
Future.await(long, TimeUnit) ()}
Future.await(long) ()}
ChannelFuture.awaitUninterruptibly()
ChannelFuture.sync()
ChannelFuture.syncUninterruptibly()
|
void |
operationComplete(ChannelFuture future)
Invoked when the operation associated with the
Future has been completed. |
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.
|
boolean |
setUncancellable()
Make this future impossible to cancel.
|
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 |
tryFailure(java.lang.Throwable cause)
Marks this future as a failure and notifies all
listeners.
|
boolean |
trySuccess() |
boolean |
trySuccess(java.lang.Void result)
Marks this future as a success and notifies all
listeners.
|
ChannelPromise |
unvoid()
|
public DelegatingChannelPromiseNotifier(ChannelPromise delegate)
public DelegatingChannelPromiseNotifier(ChannelPromise delegate, boolean logNotifyFailure)
public void operationComplete(ChannelFuture future) throws java.lang.Exception
GenericFutureListener
Future
has been completed.operationComplete
在接口中 GenericFutureListener<ChannelFuture>
future
- the source Future
which called this callbackjava.lang.Exception
public Channel channel()
ChannelFuture
channel
在接口中 ChannelFuture
channel
在接口中 ChannelPromise
public ChannelPromise setSuccess(java.lang.Void result)
Promise
IllegalStateException
.setSuccess
在接口中 ChannelPromise
setSuccess
在接口中 Promise<java.lang.Void>
public ChannelPromise setSuccess()
setSuccess
在接口中 ChannelPromise
public boolean trySuccess()
trySuccess
在接口中 ChannelPromise
public boolean trySuccess(java.lang.Void result)
Promise
trySuccess
在接口中 Promise<java.lang.Void>
true
if and only if successfully marked this future as
a success. Otherwise false
because this future is
already marked as either a success or a failure.public ChannelPromise setFailure(java.lang.Throwable cause)
Promise
IllegalStateException
.setFailure
在接口中 ChannelPromise
setFailure
在接口中 Promise<java.lang.Void>
public ChannelPromise addListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Future
addListener
在接口中 ChannelFuture
addListener
在接口中 ChannelPromise
addListener
在接口中 Promise<java.lang.Void>
public ChannelPromise addListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Future
addListeners
在接口中 ChannelFuture
addListeners
在接口中 ChannelPromise
addListeners
在接口中 Promise<java.lang.Void>
public ChannelPromise removeListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Future
removeListener
在接口中 ChannelFuture
removeListener
在接口中 ChannelPromise
removeListener
在接口中 Promise<java.lang.Void>
public ChannelPromise removeListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Future
removeListeners
在接口中 ChannelFuture
removeListeners
在接口中 ChannelPromise
removeListeners
在接口中 Promise<java.lang.Void>
public boolean tryFailure(java.lang.Throwable cause)
Promise
tryFailure
在接口中 Promise<java.lang.Void>
true
if and only if successfully marked this future as
a failure. Otherwise false
because this future is
already marked as either a success or a failure.public boolean setUncancellable()
Promise
setUncancellable
在接口中 Promise<java.lang.Void>
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.public ChannelPromise await() throws java.lang.InterruptedException
Future
await
在接口中 ChannelFuture
await
在接口中 ChannelPromise
await
在接口中 Promise<java.lang.Void>
java.lang.InterruptedException
- if the current thread was interruptedpublic ChannelPromise awaitUninterruptibly()
Future
InterruptedException
and
discards it silently.awaitUninterruptibly
在接口中 ChannelFuture
awaitUninterruptibly
在接口中 ChannelPromise
awaitUninterruptibly
在接口中 Promise<java.lang.Void>
public boolean isVoid()
ChannelFuture
true
if this ChannelFuture
is a void future and so not allow to call any of the
following methods:
isVoid
在接口中 ChannelFuture
public ChannelPromise unvoid()
ChannelPromise
unvoid
在接口中 ChannelPromise
public boolean await(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
Future
true
if and only if the future was completed within
the specified time limitjava.lang.InterruptedException
- if the current thread was interruptedpublic boolean await(long timeoutMillis) throws java.lang.InterruptedException
Future
true
if and only if the future was completed within
the specified time limitjava.lang.InterruptedException
- if the current thread was interruptedpublic boolean awaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit)
Future
InterruptedException
and discards it silently.true
if and only if the future was completed within
the specified time limitpublic boolean awaitUninterruptibly(long timeoutMillis)
Future
InterruptedException
and discards it silently.true
if and only if the future was completed within
the specified time limitpublic java.lang.Void getNow()
Future
null
.
As it is possible that a null
value is used to mark the future as successful you also need to check
if the future is really done with Future.isDone()
and not rely on the returned null
value.public boolean cancel(boolean mayInterruptIfRunning)
Future
CancellationException
.cancel
在接口中 java.util.concurrent.Future<java.lang.Void>
public boolean isCancelled()
isCancelled
在接口中 java.util.concurrent.Future<java.lang.Void>
public boolean isDone()
isDone
在接口中 java.util.concurrent.Future<java.lang.Void>
public java.lang.Void get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
在接口中 java.util.concurrent.Future<java.lang.Void>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public java.lang.Void get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
在接口中 java.util.concurrent.Future<java.lang.Void>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
public ChannelPromise sync() throws java.lang.InterruptedException
Future
sync
在接口中 ChannelFuture
sync
在接口中 ChannelPromise
sync
在接口中 Promise<java.lang.Void>
java.lang.InterruptedException
public ChannelPromise syncUninterruptibly()
Future
syncUninterruptibly
在接口中 ChannelFuture
syncUninterruptibly
在接口中 ChannelPromise
syncUninterruptibly
在接口中 Promise<java.lang.Void>
public boolean isSuccess()
Future
true
if and only if the I/O operation was completed
successfully.public boolean isCancellable()
Future
true
if and only if the operation can be cancelled via Future.cancel(boolean)
.public java.lang.Throwable cause()
Future
null
if succeeded or this future is not
completed yet.