Package org.apache.mina.core
Class IoUtil
- java.lang.Object
-
- org.apache.mina.core.IoUtil
-
public final class IoUtil extends Object
- Author:
- Apache MINA Project
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
await(Iterable<? extends IoFuture> futures)
static boolean
await(Iterable<? extends IoFuture> futures, long timeoutMillis)
static boolean
await(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit)
static void
awaitUninterruptably(Iterable<? extends IoFuture> futures)
Wait on all theIoFuture
s we get.static boolean
awaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeoutMillis)
Wait on all theIoFuture
s we get.static boolean
awaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit)
Wait on all theIoFuture
s we get.static List<WriteFuture>
broadcast(Object message, Iterable<IoSession> sessions)
Writes the specifiedmessage
to the specifiedsessions
.static List<WriteFuture>
broadcast(Object message, Collection<IoSession> sessions)
Writes the specifiedmessage
to the specifiedsessions
.static List<WriteFuture>
broadcast(Object message, Iterator<IoSession> sessions)
Writes the specifiedmessage
to the specifiedsessions
.static List<WriteFuture>
broadcast(Object message, IoSession... sessions)
Writes the specifiedmessage
to the specifiedsessions
.
-
-
-
Method Detail
-
broadcast
public static List<WriteFuture> broadcast(Object message, Collection<IoSession> sessions)
Writes the specifiedmessage
to the specifiedsessions
. If the specifiedmessage
is anIoBuffer
, the buffer is automatically duplicated usingIoBuffer.duplicate()
.- Parameters:
message
- The message to broadcastsessions
- The sessions that will receive the message- Returns:
- The list of WriteFuture created for each broadcasted message
-
broadcast
public static List<WriteFuture> broadcast(Object message, Iterable<IoSession> sessions)
Writes the specifiedmessage
to the specifiedsessions
. If the specifiedmessage
is anIoBuffer
, the buffer is automatically duplicated usingIoBuffer.duplicate()
.- Parameters:
message
- The message to broadcastsessions
- The sessions that will receive the message- Returns:
- The list of WriteFuture created for each broadcasted message
-
broadcast
public static List<WriteFuture> broadcast(Object message, Iterator<IoSession> sessions)
Writes the specifiedmessage
to the specifiedsessions
. If the specifiedmessage
is anIoBuffer
, the buffer is automatically duplicated usingIoBuffer.duplicate()
.- Parameters:
message
- The message to writesessions
- The sessions the message has to be written to- Returns:
- The list of
WriteFuture
for the written messages
-
broadcast
public static List<WriteFuture> broadcast(Object message, IoSession... sessions)
Writes the specifiedmessage
to the specifiedsessions
. If the specifiedmessage
is anIoBuffer
, the buffer is automatically duplicated usingIoBuffer.duplicate()
.- Parameters:
message
- The message to writesessions
- The sessions the message has to be written to- Returns:
- The list of
WriteFuture
for the written messages
-
await
public static void await(Iterable<? extends IoFuture> futures) throws InterruptedException
- Parameters:
futures
- TheIoFuture
s we are waiting on- Throws:
InterruptedException
- If one of theIoFuture
is interrupted
-
awaitUninterruptably
public static void awaitUninterruptably(Iterable<? extends IoFuture> futures)
Wait on all theIoFuture
s we get. This can't get interrupted.- Parameters:
futures
- TheIoFuture
s we are waiting on
-
await
public static boolean await(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit) throws InterruptedException
- Parameters:
futures
- TheIoFuture
s we are waiting ontimeout
- The maximum time we wait for theIoFuture
s to completeunit
- The Time unit to use for the timeout- Returns:
- TRUE if all the
IoFuture
have been completed, FALSE if at least oneIoFuture
haas been interrupted - Throws:
InterruptedException
- If one of theIoFuture
is interrupted
-
await
public static boolean await(Iterable<? extends IoFuture> futures, long timeoutMillis) throws InterruptedException
- Parameters:
futures
- TheIoFuture
s we are waiting ontimeoutMillis
- The maximum milliseconds we wait for theIoFuture
s to complete- Returns:
- TRUE if all the
IoFuture
have been completed, FALSE if at least oneIoFuture
has been interrupted - Throws:
InterruptedException
- If one of theIoFuture
is interrupted
-
awaitUninterruptibly
public static boolean awaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit)
Wait on all theIoFuture
s we get.
-
-