Package io.netty.channel.group
Class DefaultChannelGroupFuture
- All Implemented Interfaces:
ChannelGroupFuture,Future<Void>,Promise<Void>,Iterable<ChannelFuture>,Future<Void>
The default
ChannelGroupFuture implementation.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classNested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ChannelFutureListenerprivate intprivate final Map<Channel, ChannelFuture> private final ChannelGroupprivate intFields inherited from class io.netty.util.concurrent.DefaultPromise
PROPERTY_MAX_LISTENER_STACK_DEPTH -
Constructor Summary
ConstructorsConstructorDescriptionDefaultChannelGroupFuture(ChannelGroup group, Collection<ChannelFuture> futures, EventExecutor executor) Creates a new instance.DefaultChannelGroupFuture(ChannelGroup group, Map<Channel, ChannelFuture> futures, EventExecutor executor) -
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.cause()Returns the cause of the failed I/O operation if the I/O operation has failed.protected voidReturns theChannelFutureof the individual I/O operation which is associated with the specifiedChannel.group()Returns theChannelGroupwhich is associated with this future.booleanReturnstrueif and only if the I/O operations associated with this future have failed partially with some success.booleanReturnstrueif and only if the I/O operations associated with this future were partially successful with some failure.iterator()Returns theIteratorthat enumerates allChannelFutures which are associated with this future.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.setFailure(Throwable cause) Marks this future as a failure and notifies all listeners.private voidsetFailure0(ChannelGroupException cause) setSuccess(Void result) Marks this future as a success and notifies all listeners.private voidsync()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.booleantryFailure(Throwable cause) Marks this future as a failure and notifies all listeners.booleantrySuccess(Void result) Marks this future as a success and notifies all listeners.Methods inherited from class io.netty.util.concurrent.DefaultPromise
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, executor, get, get, getNow, isCancellable, isCancelled, isDone, isSuccess, notifyListener, setUncancellable, toString, toStringBuilderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.netty.channel.group.ChannelGroupFuture
isSuccessMethods inherited from interface io.netty.util.concurrent.Future
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, getNow, isCancellableMethods inherited from interface java.util.concurrent.Future
exceptionNow, get, get, isCancelled, isDone, resultNow, stateMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
group
-
futures
-
successCount
private int successCount -
failureCount
private int failureCount -
childListener
-
-
Constructor Details
-
DefaultChannelGroupFuture
DefaultChannelGroupFuture(ChannelGroup group, Collection<ChannelFuture> futures, EventExecutor executor) Creates a new instance. -
DefaultChannelGroupFuture
DefaultChannelGroupFuture(ChannelGroup group, Map<Channel, ChannelFuture> futures, EventExecutor executor)
-
-
Method Details
-
group
Description copied from interface:ChannelGroupFutureReturns theChannelGroupwhich is associated with this future.- Specified by:
groupin interfaceChannelGroupFuture
-
find
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.
-
iterator
Description copied from interface:ChannelGroupFutureReturns theIteratorthat enumerates allChannelFutures which are associated with this future. Please note that the returnedIteratoris unmodifiable, which means aChannelFuturecannot be removed from this future.- Specified by:
iteratorin interfaceChannelGroupFuture- Specified by:
iteratorin interfaceIterable<ChannelFuture>
-
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 DefaultChannelGroupFuture addListener(GenericFutureListener<? extends Future<? super 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<Void>- Specified by:
addListenerin interfacePromise<Void>- Overrides:
addListenerin classDefaultPromise<Void>
-
addListeners
public DefaultChannelGroupFuture addListeners(GenericFutureListener<? extends Future<? super 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<Void>- Specified by:
addListenersin interfacePromise<Void>- Overrides:
addListenersin classDefaultPromise<Void>
-
removeListener
public DefaultChannelGroupFuture removeListener(GenericFutureListener<? extends Future<? super 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<Void>- Specified by:
removeListenerin interfacePromise<Void>- Overrides:
removeListenerin classDefaultPromise<Void>
-
removeListeners
public DefaultChannelGroupFuture removeListeners(GenericFutureListener<? extends Future<? super 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<Void>- Specified by:
removeListenersin interfacePromise<Void>- Overrides:
removeListenersin classDefaultPromise<Void>
-
await
Description copied from interface:FutureWaits for this future to be completed.- Specified by:
awaitin interfaceChannelGroupFuture- Specified by:
awaitin interfaceFuture<Void>- Specified by:
awaitin interfacePromise<Void>- Overrides:
awaitin classDefaultPromise<Void>- Throws:
InterruptedException- if the current thread was interrupted
-
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<Void>- Specified by:
awaitUninterruptiblyin interfacePromise<Void>- Overrides:
awaitUninterruptiblyin classDefaultPromise<Void>
-
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<Void>- Specified by:
syncUninterruptiblyin interfacePromise<Void>- Overrides:
syncUninterruptiblyin classDefaultPromise<Void>
-
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<Void>- Specified by:
syncin interfacePromise<Void>- Overrides:
syncin classDefaultPromise<Void>- Throws:
InterruptedException
-
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<Void>- Overrides:
causein classDefaultPromise<Void>- Returns:
- the cause of the failure.
nullif succeeded or this future is not completed yet.
-
setSuccess0
private void setSuccess0() -
setFailure0
-
setSuccess
Description copied from interface:PromiseMarks this future as a success and notifies all listeners. If it is success or failed already it will throw anIllegalStateException.- Specified by:
setSuccessin interfacePromise<Void>- Overrides:
setSuccessin classDefaultPromise<Void>
-
trySuccess
Description copied from interface:PromiseMarks this future as a success and notifies all listeners.- Specified by:
trySuccessin interfacePromise<Void>- Overrides:
trySuccessin classDefaultPromise<Void>- Returns:
trueif and only if successfully marked this future as a success. Otherwisefalsebecause this future is already marked as either a success or a failure.
-
setFailure
Description copied from interface:PromiseMarks this future as a failure and notifies all listeners. If it is success or failed already it will throw anIllegalStateException.- Specified by:
setFailurein interfacePromise<Void>- Overrides:
setFailurein classDefaultPromise<Void>
-
tryFailure
Description copied from interface:PromiseMarks this future as a failure and notifies all listeners.- Specified by:
tryFailurein interfacePromise<Void>- Overrides:
tryFailurein classDefaultPromise<Void>- Returns:
trueif and only if successfully marked this future as a failure. Otherwisefalsebecause this future is already marked as either a success or a failure.
-
checkDeadLock
protected void checkDeadLock()- Overrides:
checkDeadLockin classDefaultPromise<Void>
-