public class DefaultChannelFuture extends java.lang.Object implements ChannelFuture
ChannelFuture
implementation. It is recommended to
use Channels.future(Channel)
and Channels.future(Channel, boolean)
to create a new ChannelFuture
rather than calling the constructor
explicitly.构造器和说明 |
---|
DefaultChannelFuture(Channel channel,
boolean cancellable)
Creates a new instance.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addListener(ChannelFutureListener listener)
Adds the specified listener to this future.
|
ChannelFuture |
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.
|
ChannelFuture |
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()
Cancels the I/O operation associated with this future
and notifies all listeners if canceled successfully.
|
java.lang.Throwable |
getCause()
Returns the cause of the failed I/O operation if the I/O operation has
failed.
|
Channel |
getChannel()
Returns a channel where the I/O operation associated with this
future takes place.
|
boolean |
isCancelled()
Returns
true if and only if this future was
cancelled by a ChannelFuture.cancel() method. |
boolean |
isDone()
Returns
true if and only if this future is
complete, regardless of whether the operation was successful, failed,
or cancelled. |
boolean |
isSuccess()
Returns
true if and only if the I/O operation was completed
successfully. |
static boolean |
isUseDeadLockChecker()
Returns
true if and only if the dead lock checker is enabled. |
void |
removeListener(ChannelFutureListener listener)
Removes the specified listener from this future.
|
boolean |
setFailure(java.lang.Throwable cause)
Marks this future as a failure and notifies all
listeners.
|
boolean |
setProgress(long amount,
long current,
long total)
Notifies the progress of the operation to the listeners that implements
ChannelFutureProgressListener . |
boolean |
setSuccess()
Marks this future as a success and notifies all
listeners.
|
static void |
setUseDeadLockChecker(boolean useDeadLockChecker)
Enables or disables the dead lock checker.
|
ChannelFuture |
sync()
Waits for this future until it is done, and rethrows the cause of the failure if this future
failed.
|
ChannelFuture |
syncUninterruptibly()
Waits for this future until it is done, and rethrows the cause of the failure if this future
failed.
|
public static boolean isUseDeadLockChecker()
true
if and only if the dead lock checker is enabled.public static void setUseDeadLockChecker(boolean useDeadLockChecker)
public Channel getChannel()
ChannelFuture
getChannel
在接口中 ChannelFuture
public boolean isDone()
ChannelFuture
true
if and only if this future is
complete, regardless of whether the operation was successful, failed,
or cancelled.isDone
在接口中 ChannelFuture
public boolean isSuccess()
ChannelFuture
true
if and only if the I/O operation was completed
successfully.isSuccess
在接口中 ChannelFuture
public java.lang.Throwable getCause()
ChannelFuture
getCause
在接口中 ChannelFuture
null
if succeeded or this future is not
completed yet.public boolean isCancelled()
ChannelFuture
true
if and only if this future was
cancelled by a ChannelFuture.cancel()
method.isCancelled
在接口中 ChannelFuture
public void addListener(ChannelFutureListener listener)
ChannelFuture
addListener
在接口中 ChannelFuture
public void removeListener(ChannelFutureListener listener)
ChannelFuture
removeListener
在接口中 ChannelFuture
public ChannelFuture sync() throws java.lang.InterruptedException
ChannelFuture
ChannelException
before being thrown.sync
在接口中 ChannelFuture
java.lang.InterruptedException
public ChannelFuture syncUninterruptibly()
ChannelFuture
ChannelException
before being thrown.syncUninterruptibly
在接口中 ChannelFuture
public ChannelFuture await() throws java.lang.InterruptedException
ChannelFuture
await
在接口中 ChannelFuture
java.lang.InterruptedException
- if the current thread was interruptedpublic boolean await(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
ChannelFuture
await
在接口中 ChannelFuture
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
ChannelFuture
await
在接口中 ChannelFuture
true
if and only if the future was completed within
the specified time limitjava.lang.InterruptedException
- if the current thread was interruptedpublic ChannelFuture awaitUninterruptibly()
ChannelFuture
InterruptedException
and
discards it silently.awaitUninterruptibly
在接口中 ChannelFuture
public boolean awaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit)
ChannelFuture
InterruptedException
and discards it silently.awaitUninterruptibly
在接口中 ChannelFuture
true
if and only if the future was completed within
the specified time limitpublic boolean awaitUninterruptibly(long timeoutMillis)
ChannelFuture
InterruptedException
and discards it silently.awaitUninterruptibly
在接口中 ChannelFuture
true
if and only if the future was completed within
the specified time limitpublic boolean setSuccess()
ChannelFuture
setSuccess
在接口中 ChannelFuture
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 boolean setFailure(java.lang.Throwable cause)
ChannelFuture
setFailure
在接口中 ChannelFuture
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 cancel()
ChannelFuture
cancel
在接口中 ChannelFuture
true
if and only if the operation has been canceled.
false
if the operation can't be canceled or is already
completed.public boolean setProgress(long amount, long current, long total)
ChannelFuture
ChannelFutureProgressListener
. Please note that this method will
not do anything and return false
if this future is complete
already.setProgress
在接口中 ChannelFuture
true
if and only if notification was made.