Package org.apache.mina.core
Class IoUtil
- java.lang.Object
-
- org.apache.mina.core.IoUtil
-
public final class IoUtil extends java.lang.Object
- Author:
- Apache MINA Project
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
await(java.lang.Iterable<? extends IoFuture> futures)
static boolean
await(java.lang.Iterable<? extends IoFuture> futures, long timeoutMillis)
static boolean
await(java.lang.Iterable<? extends IoFuture> futures, long timeout, java.util.concurrent.TimeUnit unit)
static void
awaitUninterruptably(java.lang.Iterable<? extends IoFuture> futures)
Wait on all theIoFuture
s we get.static boolean
awaitUninterruptibly(java.lang.Iterable<? extends IoFuture> futures, long timeoutMillis)
Wait on all theIoFuture
s we get.static boolean
awaitUninterruptibly(java.lang.Iterable<? extends IoFuture> futures, long timeout, java.util.concurrent.TimeUnit unit)
Wait on all theIoFuture
s we get.static java.util.List<WriteFuture>
broadcast(java.lang.Object message, java.lang.Iterable<IoSession> sessions)
Writes the specifiedmessage
to the specifiedsessions
.static java.util.List<WriteFuture>
broadcast(java.lang.Object message, java.util.Collection<IoSession> sessions)
Writes the specifiedmessage
to the specifiedsessions
.static java.util.List<WriteFuture>
broadcast(java.lang.Object message, java.util.Iterator<IoSession> sessions)
Writes the specifiedmessage
to the specifiedsessions
.static java.util.List<WriteFuture>
broadcast(java.lang.Object message, IoSession... sessions)
Writes the specifiedmessage
to the specifiedsessions
.
-
-
-
Method Detail
-
broadcast
public static java.util.List<WriteFuture> broadcast(java.lang.Object message, java.util.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 java.util.List<WriteFuture> broadcast(java.lang.Object message, java.lang.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 java.util.List<WriteFuture> broadcast(java.lang.Object message, java.util.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 java.util.List<WriteFuture> broadcast(java.lang.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(java.lang.Iterable<? extends IoFuture> futures) throws java.lang.InterruptedException
-
awaitUninterruptably
public static void awaitUninterruptably(java.lang.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(java.lang.Iterable<? extends IoFuture> futures, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.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:
java.lang.InterruptedException
- If one of theIoFuture
is interrupted
-
await
public static boolean await(java.lang.Iterable<? extends IoFuture> futures, long timeoutMillis) throws java.lang.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:
java.lang.InterruptedException
- If one of theIoFuture
is interrupted
-
awaitUninterruptibly
public static boolean awaitUninterruptibly(java.lang.Iterable<? extends IoFuture> futures, long timeout, java.util.concurrent.TimeUnit unit)
Wait on all theIoFuture
s we get.
-
-