Package io.netty.channel
Class CompleteChannelFuture
- java.lang.Object
-
- io.netty.util.concurrent.AbstractFuture<V>
-
- io.netty.util.concurrent.CompleteFuture<java.lang.Void>
-
- io.netty.channel.CompleteChannelFuture
-
- All Implemented Interfaces:
ChannelFuture
,Future<java.lang.Void>
,java.util.concurrent.Future<java.lang.Void>
- Direct Known Subclasses:
FailedChannelFuture
,SucceededChannelFuture
abstract class CompleteChannelFuture extends CompleteFuture<java.lang.Void> implements ChannelFuture
A skeletalChannelFuture
implementation which represents aChannelFuture
which has been completed already.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CompleteChannelFuture(Channel channel, EventExecutor executor)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelFuture
addListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Adds the specified listener to this future.ChannelFuture
addListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Adds the specified listeners to this future.ChannelFuture
await()
Waits for this future to be completed.ChannelFuture
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 EventExecutor
executor()
Return theEventExecutor
which is used by thisCompleteFuture
.java.lang.Void
getNow()
Return the result without blocking.boolean
isVoid()
Returnstrue
if thisChannelFuture
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()
ChannelFuture
removeListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Removes the first occurrence of the specified listener from this future.ChannelFuture
removeListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Removes the first occurrence for each of the listeners from this future.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.-
Methods inherited from class io.netty.util.concurrent.CompleteFuture
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, isCancellable, isCancelled, isDone
-
Methods inherited from class io.netty.util.concurrent.AbstractFuture
get, get
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.util.concurrent.Future
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, isCancellable, isSuccess
-
-
-
-
Field Detail
-
channel
private final Channel channel
-
-
Constructor Detail
-
CompleteChannelFuture
protected CompleteChannelFuture(Channel channel, EventExecutor executor)
Creates a new instance.- Parameters:
channel
- theChannel
associated with this future
-
-
Method Detail
-
executor
protected EventExecutor executor()
Description copied from class:CompleteFuture
Return theEventExecutor
which is used by thisCompleteFuture
.- Overrides:
executor
in classCompleteFuture<java.lang.Void>
-
addListener
public ChannelFuture 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>
- Overrides:
addListener
in classCompleteFuture<java.lang.Void>
-
addListeners
public ChannelFuture 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>
- Overrides:
addListeners
in classCompleteFuture<java.lang.Void>
-
removeListener
public ChannelFuture 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>
- Overrides:
removeListener
in classCompleteFuture<java.lang.Void>
-
removeListeners
public ChannelFuture 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>
- Overrides:
removeListeners
in classCompleteFuture<java.lang.Void>
-
syncUninterruptibly
public ChannelFuture 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>
- Overrides:
syncUninterruptibly
in classCompleteFuture<java.lang.Void>
-
sync
public ChannelFuture 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.- Specified by:
sync
in interfaceChannelFuture
- Specified by:
sync
in interfaceFuture<java.lang.Void>
- Overrides:
sync
in classCompleteFuture<java.lang.Void>
- Throws:
java.lang.InterruptedException
-
await
public ChannelFuture await() throws java.lang.InterruptedException
Description copied from interface:Future
Waits for this future to be completed.- Specified by:
await
in interfaceChannelFuture
- Specified by:
await
in interfaceFuture<java.lang.Void>
- Overrides:
await
in classCompleteFuture<java.lang.Void>
- Throws:
java.lang.InterruptedException
- if the current thread was interrupted
-
awaitUninterruptibly
public ChannelFuture 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>
- Overrides:
awaitUninterruptibly
in classCompleteFuture<java.lang.Void>
-
channel
public 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
-
getNow
public java.lang.Void getNow()
Description copied from interface:Future
Return the result without blocking. If the future is not done yet this will returnnull
. As it is possible that anull
value is used to mark the future as successful you also need to check if the future is really done withFuture.isDone()
and not rely on the returnednull
value.
-
isVoid
public boolean isVoid()
Description copied from interface:ChannelFuture
Returnstrue
if thisChannelFuture
is a void future and so not allow to call any of the following methods:- Specified by:
isVoid
in interfaceChannelFuture
-
-