Package io.netty.channel.group
Class VoidChannelGroupFuture
- java.lang.Object
-
- io.netty.channel.group.VoidChannelGroupFuture
-
- All Implemented Interfaces:
ChannelGroupFuture,Future<java.lang.Void>,java.lang.Iterable<ChannelFuture>,java.util.concurrent.Future<java.lang.Void>
final class VoidChannelGroupFuture extends java.lang.Object implements ChannelGroupFuture
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Iterator<ChannelFuture>EMPTYprivate ChannelGroupgroup
-
Constructor Summary
Constructors Constructor Description VoidChannelGroupFuture(ChannelGroup group)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelGroupFutureaddListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)Adds the specified listener to this future.ChannelGroupFutureaddListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)Adds the specified listeners to this future.ChannelGroupFutureawait()Waits for this future to be completed.booleanawait(long timeoutMillis)Waits for this future to be completed within the specified time limit.booleanawait(long timeout, java.util.concurrent.TimeUnit unit)Waits for this future to be completed within the specified time limit.ChannelGroupFutureawaitUninterruptibly()Waits for this future to be completed without interruption.booleanawaitUninterruptibly(long timeoutMillis)Waits for this future to be completed within the specified time limit without interruption.booleanawaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit)Waits for this future to be completed within the specified time limit without interruption.booleancancel(boolean mayInterruptIfRunning)If the cancellation was successful it will fail the future with aCancellationException.ChannelGroupExceptioncause()Returns the cause of the failed I/O operation if the I/O operation has failed.ChannelFuturefind(Channel channel)Returns theChannelFutureof the individual I/O operation which is associated with the specifiedChannel.java.lang.Voidget()java.lang.Voidget(long timeout, java.util.concurrent.TimeUnit unit)java.lang.VoidgetNow()Return the result without blocking.ChannelGroupgroup()Returns theChannelGroupwhich is associated with this future.booleanisCancellable()returnstrueif and only if the operation can be cancelled viaFuture.cancel(boolean).booleanisCancelled()booleanisDone()booleanisPartialFailure()Returnstrueif and only if the I/O operations associated with this future have failed partially with some success.booleanisPartialSuccess()Returnstrueif and only if the I/O operations associated with this future were partially successful with some failure.booleanisSuccess()Returnstrueif and only if all I/O operations associated with this future were successful without any failure.java.util.Iterator<ChannelFuture>iterator()Returns theIteratorthat enumerates allChannelFutures which are associated with this future.private static java.lang.RuntimeExceptionreject()ChannelGroupFutureremoveListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)Removes the first occurrence of the specified listener from this future.ChannelGroupFutureremoveListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)Removes the first occurrence for each of the listeners from this future.ChannelGroupFuturesync()Waits for this future until it is done, and rethrows the cause of the failure if this future failed.ChannelGroupFuturesyncUninterruptibly()Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
-
-
-
Field Detail
-
EMPTY
private static final java.util.Iterator<ChannelFuture> EMPTY
-
group
private final ChannelGroup group
-
-
Constructor Detail
-
VoidChannelGroupFuture
VoidChannelGroupFuture(ChannelGroup group)
-
-
Method Detail
-
group
public ChannelGroup group()
Description copied from interface:ChannelGroupFutureReturns theChannelGroupwhich is associated with this future.- Specified by:
groupin interfaceChannelGroupFuture
-
find
public ChannelFuture find(Channel channel)
Description copied from interface:ChannelGroupFutureReturns theChannelFutureof the individual I/O operation which is associated with the specifiedChannel.- Specified by:
findin interfaceChannelGroupFuture- Returns:
- the matching
ChannelFutureif found.nullotherwise.
-
isSuccess
public boolean isSuccess()
Description copied from interface:ChannelGroupFutureReturnstrueif and only if all I/O operations associated with this future were successful without any failure.- Specified by:
isSuccessin interfaceChannelGroupFuture- Specified by:
isSuccessin interfaceFuture<java.lang.Void>
-
cause
public ChannelGroupException cause()
Description copied from interface:FutureReturns the cause of the failed I/O operation if the I/O operation has failed.- Specified by:
causein interfaceChannelGroupFuture- Specified by:
causein interfaceFuture<java.lang.Void>- Returns:
- the cause of the failure.
nullif succeeded or this future is not completed yet.
-
isPartialSuccess
public boolean isPartialSuccess()
Description copied from interface:ChannelGroupFutureReturnstrueif and only if the I/O operations associated with this future were partially successful with some failure.- Specified by:
isPartialSuccessin interfaceChannelGroupFuture
-
isPartialFailure
public boolean isPartialFailure()
Description copied from interface:ChannelGroupFutureReturnstrueif and only if the I/O operations associated with this future have failed partially with some success.- Specified by:
isPartialFailurein interfaceChannelGroupFuture
-
addListener
public ChannelGroupFuture 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 interfaceChannelGroupFuture- Specified by:
addListenerin interfaceFuture<java.lang.Void>
-
addListeners
public ChannelGroupFuture 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 interfaceChannelGroupFuture- Specified by:
addListenersin interfaceFuture<java.lang.Void>
-
removeListener
public ChannelGroupFuture 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 interfaceChannelGroupFuture- Specified by:
removeListenerin interfaceFuture<java.lang.Void>
-
removeListeners
public ChannelGroupFuture 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 interfaceChannelGroupFuture- Specified by:
removeListenersin interfaceFuture<java.lang.Void>
-
await
public ChannelGroupFuture await()
Description copied from interface:FutureWaits for this future to be completed.- Specified by:
awaitin interfaceChannelGroupFuture- Specified by:
awaitin interfaceFuture<java.lang.Void>
-
awaitUninterruptibly
public ChannelGroupFuture awaitUninterruptibly()
Description copied from interface:FutureWaits for this future to be completed without interruption. This method catches anInterruptedExceptionand discards it silently.- Specified by:
awaitUninterruptiblyin interfaceChannelGroupFuture- Specified by:
awaitUninterruptiblyin interfaceFuture<java.lang.Void>
-
syncUninterruptibly
public ChannelGroupFuture 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 interfaceChannelGroupFuture- Specified by:
syncUninterruptiblyin interfaceFuture<java.lang.Void>
-
sync
public ChannelGroupFuture sync()
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 interfaceChannelGroupFuture- Specified by:
syncin interfaceFuture<java.lang.Void>
-
iterator
public java.util.Iterator<ChannelFuture> iterator()
Description copied from interface:ChannelGroupFutureReturns theIteratorthat enumerates allChannelFutures which are associated with this future. Please note that the returnedIteratoris is unmodifiable, which means aChannelFuturecannot be removed from this future.- Specified by:
iteratorin interfaceChannelGroupFuture- Specified by:
iteratorin interfacejava.lang.Iterable<ChannelFuture>
-
isCancellable
public boolean isCancellable()
Description copied from interface:Futurereturnstrueif and only if the operation can be cancelled viaFuture.cancel(boolean).- Specified by:
isCancellablein interfaceFuture<java.lang.Void>
-
await
public boolean await(long timeout, java.util.concurrent.TimeUnit unit)Description copied from interface:FutureWaits for this future to be completed within the specified time limit.
-
await
public boolean await(long timeoutMillis)
Description copied from interface:FutureWaits for this future to be completed within the specified time limit.
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit)Description copied from interface:FutureWaits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedExceptionand discards it silently.- Specified by:
awaitUninterruptiblyin interfaceFuture<java.lang.Void>- Returns:
trueif and only if the future was completed within the specified time limit
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis)
Description copied from interface:FutureWaits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedExceptionand discards it silently.- Specified by:
awaitUninterruptiblyin interfaceFuture<java.lang.Void>- Returns:
trueif and only if the future was completed within the specified time limit
-
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.
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
If the cancellation was successful it will fail the future with aCancellationException.
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelledin interfacejava.util.concurrent.Future<java.lang.Void>
-
isDone
public boolean isDone()
- Specified by:
isDonein interfacejava.util.concurrent.Future<java.lang.Void>
-
get
public java.lang.Void get()
- Specified by:
getin interfacejava.util.concurrent.Future<java.lang.Void>
-
get
public java.lang.Void get(long timeout, java.util.concurrent.TimeUnit unit)- Specified by:
getin interfacejava.util.concurrent.Future<java.lang.Void>
-
reject
private static java.lang.RuntimeException reject()
-
-