Package org.jboss.netty.channel
Class CompleteChannelFuture
java.lang.Object
org.jboss.netty.channel.CompleteChannelFuture
- All Implemented Interfaces:
ChannelFuture
- Direct Known Subclasses:
FailedChannelFuture
,SucceededChannelFuture
A skeletal
ChannelFuture
implementation which represents a
ChannelFuture
which has been completed already.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CompleteChannelFuture
(Channel channel) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(ChannelFutureListener listener) Adds the specified listener to this future.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
Waits for this future to be completed within the specified time limit.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, 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.Returns a channel where the I/O operation associated with this future takes place.boolean
Returnstrue
if and only if this future was cancelled by aChannelFuture.cancel()
method.boolean
isDone()
Returnstrue
if and only if this future is complete, regardless of whether the operation was successful, failed, or cancelled.void
removeListener
(ChannelFutureListener listener) Removes the specified listener from this future.boolean
setFailure
(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 implementsChannelFutureProgressListener
.boolean
Marks this future as a success and notifies all listeners.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jboss.netty.channel.ChannelFuture
getCause, isSuccess, sync, syncUninterruptibly
-
Field Details
-
logger
-
channel
-
-
Constructor Details
-
CompleteChannelFuture
Creates a new instance.- Parameters:
channel
- theChannel
associated with this future
-
-
Method Details
-
addListener
Description copied from interface:ChannelFuture
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
-
removeListener
Description copied from interface:ChannelFuture
Removes 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
-
await
Description copied from interface:ChannelFuture
Waits for this future to be completed.- Specified by:
await
in interfaceChannelFuture
- Throws:
InterruptedException
- if the current thread was interrupted
-
await
Description copied from interface:ChannelFuture
Waits for this future to be completed within the specified time limit.- Specified by:
await
in interfaceChannelFuture
- Returns:
true
if and only if the future was completed within the specified time limit- Throws:
InterruptedException
- if the current thread was interrupted
-
await
Description copied from interface:ChannelFuture
Waits for this future to be completed within the specified time limit.- Specified by:
await
in interfaceChannelFuture
- Returns:
true
if and only if the future was completed within the specified time limit- Throws:
InterruptedException
- if the current thread was interrupted
-
awaitUninterruptibly
Description copied from interface:ChannelFuture
Waits for this future to be completed without interruption. This method catches anInterruptedException
and discards it silently.- Specified by:
awaitUninterruptibly
in interfaceChannelFuture
-
awaitUninterruptibly
Description copied from interface:ChannelFuture
Waits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedException
and discards it silently.- Specified by:
awaitUninterruptibly
in interfaceChannelFuture
- Returns:
true
if and only if the future was completed within the specified time limit
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis) Description copied from interface:ChannelFuture
Waits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedException
and discards it silently.- Specified by:
awaitUninterruptibly
in interfaceChannelFuture
- Returns:
true
if and only if the future was completed within the specified time limit
-
getChannel
Description copied from interface:ChannelFuture
Returns a channel where the I/O operation associated with this future takes place.- Specified by:
getChannel
in interfaceChannelFuture
-
isDone
public boolean isDone()Description copied from interface:ChannelFuture
Returnstrue
if and only if this future is complete, regardless of whether the operation was successful, failed, or cancelled.- Specified by:
isDone
in interfaceChannelFuture
-
setProgress
public boolean setProgress(long amount, long current, long total) Description copied from interface:ChannelFuture
Notifies the progress of the operation to the listeners that implementsChannelFutureProgressListener
. Please note that this method will not do anything and returnfalse
if this future is complete already.- Specified by:
setProgress
in interfaceChannelFuture
- Returns:
true
if and only if notification was made.
-
setFailure
Description copied from interface:ChannelFuture
Marks this future as a failure and notifies all listeners.- Specified by:
setFailure
in interfaceChannelFuture
- Returns:
true
if and only if successfully marked this future as a failure. Otherwisefalse
because this future is already marked as either a success or a failure.
-
setSuccess
public boolean setSuccess()Description copied from interface:ChannelFuture
Marks this future as a success and notifies all listeners.- Specified by:
setSuccess
in interfaceChannelFuture
- Returns:
true
if and only if successfully marked this future as a success. Otherwisefalse
because this future is already marked as either a success or a failure.
-
cancel
public boolean cancel()Description copied from interface:ChannelFuture
Cancels the I/O operation associated with this future and notifies all listeners if canceled successfully.- Specified by:
cancel
in interfaceChannelFuture
- Returns:
true
if and only if the operation has been canceled.false
if the operation can't be canceled or is already completed.
-
isCancelled
public boolean isCancelled()Description copied from interface:ChannelFuture
Returnstrue
if and only if this future was cancelled by aChannelFuture.cancel()
method.- Specified by:
isCancelled
in interfaceChannelFuture
-