final class DefaultChannelGroupFuture extends DefaultPromise<java.lang.Void> implements ChannelGroupFuture
ChannelGroupFuture
implementation.Modifier and Type | Class and Description |
---|---|
private static class |
DefaultChannelGroupFuture.DefaultEntry<K,V> |
Modifier and Type | Field and Description |
---|---|
private ChannelFutureListener |
childListener |
private int |
failureCount |
private java.util.Map<Channel,ChannelFuture> |
futures |
private ChannelGroup |
group |
private int |
successCount |
Constructor and Description |
---|
DefaultChannelGroupFuture(ChannelGroup group,
java.util.Collection<ChannelFuture> futures,
EventExecutor executor)
Creates a new instance.
|
DefaultChannelGroupFuture(ChannelGroup group,
java.util.Map<Channel,ChannelFuture> futures,
EventExecutor executor) |
Modifier and Type | Method and Description |
---|---|
DefaultChannelGroupFuture |
addListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Adds the specified listener to this future.
|
DefaultChannelGroupFuture |
addListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Adds the specified listeners to this future.
|
DefaultChannelGroupFuture |
await()
Waits for this future to be completed.
|
DefaultChannelGroupFuture |
awaitUninterruptibly()
Waits for this future to be completed without
interruption.
|
ChannelGroupException |
cause()
Returns the cause of the failed I/O operation if the I/O operation has
failed.
|
protected void |
checkDeadLock() |
ChannelFuture |
find(Channel channel)
Returns the
ChannelFuture of the individual I/O operation which
is associated with the specified Channel . |
ChannelGroup |
group()
Returns the
ChannelGroup which is associated with this future. |
boolean |
isPartialFailure()
Returns
true if and only if the I/O operations associated with
this future have failed partially with some success. |
boolean |
isPartialSuccess()
Returns
true if and only if the I/O operations associated with
this future were partially successful with some failure. |
java.util.Iterator<ChannelFuture> |
iterator()
Returns the
Iterator that enumerates all ChannelFuture s
which are associated with this future. |
DefaultChannelGroupFuture |
removeListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Removes the first occurrence of the specified listener from this future.
|
DefaultChannelGroupFuture |
removeListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Removes the first occurrence for each of the listeners from this future.
|
DefaultChannelGroupFuture |
setFailure(java.lang.Throwable cause)
Marks this future as a failure and notifies all
listeners.
|
private void |
setFailure0(ChannelGroupException cause) |
DefaultChannelGroupFuture |
setSuccess(java.lang.Void result)
Marks this future as a success and notifies all
listeners.
|
private void |
setSuccess0() |
DefaultChannelGroupFuture |
sync()
Waits for this future until it is done, and rethrows the cause of the failure if this future
failed.
|
DefaultChannelGroupFuture |
syncUninterruptibly()
Waits for this future until it is done, and rethrows the cause of the failure if this future
failed.
|
boolean |
tryFailure(java.lang.Throwable cause)
Marks this future as a failure and notifies all
listeners.
|
boolean |
trySuccess(java.lang.Void result)
Marks this future as a success and notifies all
listeners.
|
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, executor, getNow, isCancellable, isCancelled, isDone, isSuccess, notifyListener, setUncancellable, toString, toStringBuilder
get, get
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isSuccess
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, getNow, isCancellable
private final ChannelGroup group
private final java.util.Map<Channel,ChannelFuture> futures
private int successCount
private int failureCount
private final ChannelFutureListener childListener
DefaultChannelGroupFuture(ChannelGroup group, java.util.Collection<ChannelFuture> futures, EventExecutor executor)
DefaultChannelGroupFuture(ChannelGroup group, java.util.Map<Channel,ChannelFuture> futures, EventExecutor executor)
public ChannelGroup group()
ChannelGroupFuture
ChannelGroup
which is associated with this future.group
in interface ChannelGroupFuture
public ChannelFuture find(Channel channel)
ChannelGroupFuture
ChannelFuture
of the individual I/O operation which
is associated with the specified Channel
.find
in interface ChannelGroupFuture
ChannelFuture
if found.
null
otherwise.public java.util.Iterator<ChannelFuture> iterator()
ChannelGroupFuture
Iterator
that enumerates all ChannelFuture
s
which are associated with this future. Please note that the returned
Iterator
is is unmodifiable, which means a ChannelFuture
cannot be removed from this future.iterator
in interface ChannelGroupFuture
iterator
in interface java.lang.Iterable<ChannelFuture>
public boolean isPartialSuccess()
ChannelGroupFuture
true
if and only if the I/O operations associated with
this future were partially successful with some failure.isPartialSuccess
in interface ChannelGroupFuture
public boolean isPartialFailure()
ChannelGroupFuture
true
if and only if the I/O operations associated with
this future have failed partially with some success.isPartialFailure
in interface ChannelGroupFuture
public DefaultChannelGroupFuture addListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Future
addListener
in interface ChannelGroupFuture
addListener
in interface Promise<java.lang.Void>
addListener
in class DefaultPromise<java.lang.Void>
public DefaultChannelGroupFuture addListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Future
addListeners
in interface ChannelGroupFuture
addListeners
in interface Promise<java.lang.Void>
addListeners
in class DefaultPromise<java.lang.Void>
public DefaultChannelGroupFuture removeListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
Future
removeListener
in interface ChannelGroupFuture
removeListener
in interface Promise<java.lang.Void>
removeListener
in class DefaultPromise<java.lang.Void>
public DefaultChannelGroupFuture removeListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
Future
removeListeners
in interface ChannelGroupFuture
removeListeners
in interface Promise<java.lang.Void>
removeListeners
in class DefaultPromise<java.lang.Void>
public DefaultChannelGroupFuture await() throws java.lang.InterruptedException
Future
await
in interface ChannelGroupFuture
await
in interface Promise<java.lang.Void>
await
in class DefaultPromise<java.lang.Void>
java.lang.InterruptedException
- if the current thread was interruptedpublic DefaultChannelGroupFuture awaitUninterruptibly()
Future
InterruptedException
and
discards it silently.awaitUninterruptibly
in interface ChannelGroupFuture
awaitUninterruptibly
in interface Promise<java.lang.Void>
awaitUninterruptibly
in class DefaultPromise<java.lang.Void>
public DefaultChannelGroupFuture syncUninterruptibly()
Future
syncUninterruptibly
in interface ChannelGroupFuture
syncUninterruptibly
in interface Promise<java.lang.Void>
syncUninterruptibly
in class DefaultPromise<java.lang.Void>
public DefaultChannelGroupFuture sync() throws java.lang.InterruptedException
Future
sync
in interface ChannelGroupFuture
sync
in interface Promise<java.lang.Void>
sync
in class DefaultPromise<java.lang.Void>
java.lang.InterruptedException
public ChannelGroupException cause()
Future
cause
in interface ChannelGroupFuture
cause
in class DefaultPromise<java.lang.Void>
null
if succeeded or this future is not
completed yet.private void setSuccess0()
private void setFailure0(ChannelGroupException cause)
public DefaultChannelGroupFuture setSuccess(java.lang.Void result)
Promise
IllegalStateException
.setSuccess
in interface Promise<java.lang.Void>
setSuccess
in class DefaultPromise<java.lang.Void>
public boolean trySuccess(java.lang.Void result)
Promise
trySuccess
in interface Promise<java.lang.Void>
trySuccess
in class DefaultPromise<java.lang.Void>
true
if and only if successfully marked this future as
a success. Otherwise false
because this future is
already marked as either a success or a failure.public DefaultChannelGroupFuture setFailure(java.lang.Throwable cause)
Promise
IllegalStateException
.setFailure
in interface Promise<java.lang.Void>
setFailure
in class DefaultPromise<java.lang.Void>
public boolean tryFailure(java.lang.Throwable cause)
Promise
tryFailure
in interface Promise<java.lang.Void>
tryFailure
in class DefaultPromise<java.lang.Void>
true
if and only if successfully marked this future as
a failure. Otherwise false
because this future is
already marked as either a success or a failure.protected void checkDeadLock()
checkDeadLock
in class DefaultPromise<java.lang.Void>