Package io.netty.channel
Class CompleteChannelFuture
- All Implemented Interfaces:
ChannelFuture
,Future<Void>
,Future<Void>
- Direct Known Subclasses:
FailedChannelFuture
,SucceededChannelFuture
A skeletal
ChannelFuture
implementation which represents a
ChannelFuture
which has been completed already.-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CompleteChannelFuture
(Channel channel, EventExecutor executor) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionaddListener
(GenericFutureListener<? extends Future<? super Void>> listener) Adds the specified listener to this future.addListeners
(GenericFutureListener<? extends Future<? super Void>>... listeners) Adds the specified listeners to this future.await()
Waits for this future to be completed.Waits for this future to be completed without interruption.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
.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()
removeListener
(GenericFutureListener<? extends Future<? super Void>> listener) Removes the first occurrence of the specified listener from this future.removeListeners
(GenericFutureListener<? extends Future<? super Void>>... listeners) Removes the first occurrence for each of the listeners from this future.sync()
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.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
Methods inherited from interface java.util.concurrent.Future
exceptionNow, get, get, isCancelled, isDone, resultNow, state
-
Field Details
-
channel
-
-
Constructor Details
-
CompleteChannelFuture
Creates a new instance.- Parameters:
channel
- theChannel
associated with this future
-
-
Method Details
-
executor
Description copied from class:CompleteFuture
Return theEventExecutor
which is used by thisCompleteFuture
.- Overrides:
executor
in classCompleteFuture<Void>
-
addListener
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<Void>
- Overrides:
addListener
in classCompleteFuture<Void>
-
addListeners
public ChannelFuture addListeners(GenericFutureListener<? extends Future<? super 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<Void>
- Overrides:
addListeners
in classCompleteFuture<Void>
-
removeListener
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<Void>
- Overrides:
removeListener
in classCompleteFuture<Void>
-
removeListeners
public ChannelFuture removeListeners(GenericFutureListener<? extends Future<? super 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<Void>
- Overrides:
removeListeners
in classCompleteFuture<Void>
-
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<Void>
- Overrides:
syncUninterruptibly
in classCompleteFuture<Void>
-
sync
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<Void>
- Overrides:
sync
in classCompleteFuture<Void>
- Throws:
InterruptedException
-
await
Description copied from interface:Future
Waits for this future to be completed.- Specified by:
await
in interfaceChannelFuture
- Specified by:
await
in interfaceFuture<Void>
- Overrides:
await
in classCompleteFuture<Void>
- Throws:
InterruptedException
- if the current thread was interrupted
-
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<Void>
- Overrides:
awaitUninterruptibly
in classCompleteFuture<Void>
-
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
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 a
null
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
-