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 skeletalChannelFutureimplementation which represents aChannelFuturewhich has been completed already.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCompleteChannelFuture(Channel channel, EventExecutor executor)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelFutureaddListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)Adds the specified listener to this future.ChannelFutureaddListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)Adds the specified listeners to this future.ChannelFutureawait()Waits for this future to be completed.ChannelFutureawaitUninterruptibly()Waits for this future to be completed without interruption.Channelchannel()Returns a channel where the I/O operation associated with this future takes place.protected EventExecutorexecutor()Return theEventExecutorwhich is used by thisCompleteFuture.java.lang.VoidgetNow()Return the result without blocking.booleanisVoid()Returnstrueif thisChannelFutureis 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()ChannelFutureremoveListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)Removes the first occurrence of the specified listener from this future.ChannelFutureremoveListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)Removes the first occurrence for each of the listeners from this future.ChannelFuturesync()Waits for this future until it is done, and rethrows the cause of the failure if this future failed.ChannelFuturesyncUninterruptibly()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- theChannelassociated with this future
-
-
Method Detail
-
executor
protected EventExecutor executor()
Description copied from class:CompleteFutureReturn theEventExecutorwhich is used by thisCompleteFuture.- Overrides:
executorin classCompleteFuture<java.lang.Void>
-
addListener
public ChannelFuture addListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Description copied from interface:FutureAdds 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:
addListenerin interfaceChannelFuture- Specified by:
addListenerin interfaceFuture<java.lang.Void>- Overrides:
addListenerin classCompleteFuture<java.lang.Void>
-
addListeners
public ChannelFuture addListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Description copied from interface:FutureAdds 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:
addListenersin interfaceChannelFuture- Specified by:
addListenersin interfaceFuture<java.lang.Void>- Overrides:
addListenersin classCompleteFuture<java.lang.Void>
-
removeListener
public ChannelFuture removeListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Description copied from interface:FutureRemoves 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:
removeListenerin interfaceChannelFuture- Specified by:
removeListenerin interfaceFuture<java.lang.Void>- Overrides:
removeListenerin classCompleteFuture<java.lang.Void>
-
removeListeners
public ChannelFuture removeListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Description copied from interface:FutureRemoves 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:
removeListenersin interfaceChannelFuture- Specified by:
removeListenersin interfaceFuture<java.lang.Void>- Overrides:
removeListenersin classCompleteFuture<java.lang.Void>
-
syncUninterruptibly
public ChannelFuture syncUninterruptibly()
Description copied from interface:FutureWaits for this future until it is done, and rethrows the cause of the failure if this future failed.- Specified by:
syncUninterruptiblyin interfaceChannelFuture- Specified by:
syncUninterruptiblyin interfaceFuture<java.lang.Void>- Overrides:
syncUninterruptiblyin classCompleteFuture<java.lang.Void>
-
sync
public ChannelFuture sync() throws java.lang.InterruptedException
Description copied from interface:FutureWaits for this future until it is done, and rethrows the cause of the failure if this future failed.- Specified by:
syncin interfaceChannelFuture- Specified by:
syncin interfaceFuture<java.lang.Void>- Overrides:
syncin classCompleteFuture<java.lang.Void>- Throws:
java.lang.InterruptedException
-
await
public ChannelFuture await() throws java.lang.InterruptedException
Description copied from interface:FutureWaits for this future to be completed.- Specified by:
awaitin interfaceChannelFuture- Specified by:
awaitin interfaceFuture<java.lang.Void>- Overrides:
awaitin classCompleteFuture<java.lang.Void>- Throws:
java.lang.InterruptedException- if the current thread was interrupted
-
awaitUninterruptibly
public ChannelFuture awaitUninterruptibly()
Description copied from interface:FutureWaits for this future to be completed without interruption. This method catches anInterruptedExceptionand discards it silently.- Specified by:
awaitUninterruptiblyin interfaceChannelFuture- Specified by:
awaitUninterruptiblyin interfaceFuture<java.lang.Void>- Overrides:
awaitUninterruptiblyin classCompleteFuture<java.lang.Void>
-
channel
public Channel channel()
Description copied from interface:ChannelFutureReturns a channel where the I/O operation associated with this future takes place.- Specified by:
channelin interfaceChannelFuture
-
getNow
public java.lang.Void getNow()
Description copied from interface:FutureReturn the result without blocking. If the future is not done yet this will returnnull. As it is possible that anullvalue 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 returnednullvalue.
-
isVoid
public boolean isVoid()
Description copied from interface:ChannelFutureReturnstrueif thisChannelFutureis a void future and so not allow to call any of the following methods:- Specified by:
isVoidin interfaceChannelFuture
-
-