Package org.jboss.netty.channel.group
Class DefaultChannelGroupFuture
java.lang.Object
org.jboss.netty.channel.group.DefaultChannelGroupFuture
- All Implemented Interfaces:
Iterable<ChannelFuture>
,ChannelGroupFuture
The default
ChannelGroupFuture
implementation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ChannelFutureListener
private boolean
(package private) int
private ChannelGroupFutureListener
(package private) final Map
<Integer, ChannelFuture> private final ChannelGroup
private static final InternalLogger
private List
<ChannelGroupFutureListener> (package private) int
private int
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultChannelGroupFuture
(ChannelGroup group, Collection<ChannelFuture> futures) Creates a new instance.DefaultChannelGroupFuture
(ChannelGroup group, Map<Integer, ChannelFuture> futures) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(ChannelGroupFutureListener listener) Adds the specified listener to this future.await()
Waits for this future to be completed.boolean
await
(long timeoutMillis) Waits for this future to be completed within the specified time limit.boolean
Waits for this future to be completed within the specified time limit.private boolean
await0
(long timeoutNanos, boolean interruptable) Waits for this future to be completed without interruption.boolean
awaitUninterruptibly
(long timeoutMillis) Waits for this future to be completed within the specified time limit without interruption.boolean
awaitUninterruptibly
(long timeout, TimeUnit unit) Waits for this future to be completed within the specified time limit without interruption.private static void
Returns theChannelFuture
of the individual I/O operation which is associated with theChannel
whose ID matches the specified integer.Returns theChannelFuture
of the individual I/O operation which is associated with the specifiedChannel
.getGroup()
Returns theChannelGroup
which is associated with this future.boolean
Returnstrue
if and only if all I/O operations associated with this future have failed without any success.boolean
Returnstrue
if and only if all I/O operations associated with this future were successful without any failure.boolean
isDone()
Returnstrue
if and only if this future is complete, regardless of whether the operation was successful, failed, or canceled.boolean
Returnstrue
if and only if the I/O operations associated with this future have failed partially with some success.boolean
Returnstrue
if and only if the I/O operations associated with this future were partially successful with some failure.iterator()
Returns theIterator
that enumerates allChannelFuture
s which are associated with this future.private void
private void
void
removeListener
(ChannelGroupFutureListener listener) Removes the specified listener from this future.(package private) boolean
setDone()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
logger
-
group
-
futures
-
firstListener
-
otherListeners
-
done
private boolean done -
successCount
int successCount -
failureCount
int failureCount -
waiters
private int waiters -
childListener
-
-
Constructor Details
-
DefaultChannelGroupFuture
Creates a new instance. -
DefaultChannelGroupFuture
DefaultChannelGroupFuture(ChannelGroup group, Map<Integer, ChannelFuture> futures)
-
-
Method Details
-
getGroup
Description copied from interface:ChannelGroupFuture
Returns theChannelGroup
which is associated with this future.- Specified by:
getGroup
in interfaceChannelGroupFuture
-
find
Description copied from interface:ChannelGroupFuture
Returns theChannelFuture
of the individual I/O operation which is associated with theChannel
whose ID matches the specified integer.- Specified by:
find
in interfaceChannelGroupFuture
- Returns:
- the matching
ChannelFuture
if found.null
otherwise.
-
find
Description copied from interface:ChannelGroupFuture
Returns theChannelFuture
of the individual I/O operation which is associated with the specifiedChannel
.- Specified by:
find
in interfaceChannelGroupFuture
- Returns:
- the matching
ChannelFuture
if found.null
otherwise.
-
iterator
Description copied from interface:ChannelGroupFuture
Returns theIterator
that enumerates allChannelFuture
s which are associated with this future. Please note that the returnedIterator
is is unmodifiable, which means aChannelFuture
cannot be removed from this future.- Specified by:
iterator
in interfaceChannelGroupFuture
- Specified by:
iterator
in interfaceIterable<ChannelFuture>
-
isDone
public boolean isDone()Description copied from interface:ChannelGroupFuture
Returnstrue
if and only if this future is complete, regardless of whether the operation was successful, failed, or canceled.- Specified by:
isDone
in interfaceChannelGroupFuture
-
isCompleteSuccess
public boolean isCompleteSuccess()Description copied from interface:ChannelGroupFuture
Returnstrue
if and only if all I/O operations associated with this future were successful without any failure.- Specified by:
isCompleteSuccess
in interfaceChannelGroupFuture
-
isPartialSuccess
public boolean isPartialSuccess()Description copied from interface:ChannelGroupFuture
Returnstrue
if and only if the I/O operations associated with this future were partially successful with some failure.- Specified by:
isPartialSuccess
in interfaceChannelGroupFuture
-
isPartialFailure
public boolean isPartialFailure()Description copied from interface:ChannelGroupFuture
Returnstrue
if and only if the I/O operations associated with this future have failed partially with some success.- Specified by:
isPartialFailure
in interfaceChannelGroupFuture
-
isCompleteFailure
public boolean isCompleteFailure()Description copied from interface:ChannelGroupFuture
Returnstrue
if and only if all I/O operations associated with this future have failed without any success.- Specified by:
isCompleteFailure
in interfaceChannelGroupFuture
-
addListener
Description copied from interface:ChannelGroupFuture
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 interfaceChannelGroupFuture
-
removeListener
Description copied from interface:ChannelGroupFuture
Removes the specified listener from this future. The specified listener is no longer notified when this future is done. If this future is already completed, this method has no effect and returns silently.- Specified by:
removeListener
in interfaceChannelGroupFuture
-
await
Description copied from interface:ChannelGroupFuture
Waits for this future to be completed.- Specified by:
await
in interfaceChannelGroupFuture
- Throws:
InterruptedException
- if the current thread was interrupted
-
await
Description copied from interface:ChannelGroupFuture
Waits for this future to be completed within the specified time limit.- Specified by:
await
in interfaceChannelGroupFuture
- Returns:
true
if and only if the future was completed within the specified time limit- Throws:
InterruptedException
- if the current thread was interrupted
-
await
Description copied from interface:ChannelGroupFuture
Waits for this future to be completed within the specified time limit.- Specified by:
await
in interfaceChannelGroupFuture
- Returns:
true
if and only if the future was completed within the specified time limit- Throws:
InterruptedException
- if the current thread was interrupted
-
awaitUninterruptibly
Description copied from interface:ChannelGroupFuture
Waits for this future to be completed without interruption. This method catches anInterruptedException
and discards it silently.- Specified by:
awaitUninterruptibly
in interfaceChannelGroupFuture
-
awaitUninterruptibly
Description copied from interface:ChannelGroupFuture
Waits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedException
and discards it silently.- Specified by:
awaitUninterruptibly
in interfaceChannelGroupFuture
- Returns:
true
if and only if the future was completed within the specified time limit
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis) Description copied from interface:ChannelGroupFuture
Waits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedException
and discards it silently.- Specified by:
awaitUninterruptibly
in interfaceChannelGroupFuture
- Returns:
true
if and only if the future was completed within the specified time limit
-
await0
- Throws:
InterruptedException
-
checkDeadLock
private static void checkDeadLock() -
setDone
boolean setDone() -
notifyListeners
private void notifyListeners() -
notifyListener
-