Package org.apache.mina.core
Class IoUtil
- java.lang.Object
-
- org.apache.mina.core.IoUtil
-
public final class IoUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static IoSession[]EMPTY_SESSIONS
-
Constructor Summary
Constructors Modifier Constructor Description privateIoUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidawait(java.lang.Iterable<? extends IoFuture> futures)static booleanawait(java.lang.Iterable<? extends IoFuture> futures, long timeoutMillis)static booleanawait(java.lang.Iterable<? extends IoFuture> futures, long timeout, java.util.concurrent.TimeUnit unit)private static booleanawait0(java.lang.Iterable<? extends IoFuture> futures, long timeoutMillis, boolean interruptable)static voidawaitUninterruptably(java.lang.Iterable<? extends IoFuture> futures)Wait on all theIoFutures we get.static booleanawaitUninterruptibly(java.lang.Iterable<? extends IoFuture> futures, long timeoutMillis)Wait on all theIoFutures we get.static booleanawaitUninterruptibly(java.lang.Iterable<? extends IoFuture> futures, long timeout, java.util.concurrent.TimeUnit unit)Wait on all theIoFutures we get.static java.util.List<WriteFuture>broadcast(java.lang.Object message, java.lang.Iterable<IoSession> sessions)Writes the specifiedmessageto the specifiedsessions.static java.util.List<WriteFuture>broadcast(java.lang.Object message, java.util.Collection<IoSession> sessions)Writes the specifiedmessageto the specifiedsessions.static java.util.List<WriteFuture>broadcast(java.lang.Object message, java.util.Iterator<IoSession> sessions)Writes the specifiedmessageto the specifiedsessions.private static voidbroadcast(java.lang.Object message, java.util.Iterator<IoSession> sessions, java.util.Collection<WriteFuture> answer)static java.util.List<WriteFuture>broadcast(java.lang.Object message, IoSession... sessions)Writes the specifiedmessageto the specifiedsessions.
-
-
-
Field Detail
-
EMPTY_SESSIONS
private static final IoSession[] EMPTY_SESSIONS
-
-
Method Detail
-
broadcast
public static java.util.List<WriteFuture> broadcast(java.lang.Object message, java.util.Collection<IoSession> sessions)
Writes the specifiedmessageto the specifiedsessions. If the specifiedmessageis 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 specifiedmessageto the specifiedsessions. If the specifiedmessageis 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 specifiedmessageto the specifiedsessions. If the specifiedmessageis 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
WriteFuturefor the written messages
-
broadcast
public static java.util.List<WriteFuture> broadcast(java.lang.Object message, IoSession... sessions)
Writes the specifiedmessageto the specifiedsessions. If the specifiedmessageis 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
WriteFuturefor the written messages
-
broadcast
private static void broadcast(java.lang.Object message, java.util.Iterator<IoSession> sessions, java.util.Collection<WriteFuture> answer)
-
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 theIoFutures we get. This can't get interrupted.- Parameters:
futures- TheIoFutures 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- TheIoFutures we are waiting ontimeout- The maximum time we wait for theIoFutures to completeunit- The Time unit to use for the timeout- Returns:
TRUEif all theIoFuturehave been completed,FALSEif at least oneIoFuturehas been interrupted- Throws:
java.lang.InterruptedException- If one of theIoFutureis interrupted
-
await
public static boolean await(java.lang.Iterable<? extends IoFuture> futures, long timeoutMillis) throws java.lang.InterruptedException
- Parameters:
futures- TheIoFutures we are waiting ontimeoutMillis- The maximum milliseconds we wait for theIoFutures to complete- Returns:
TRUEif all theIoFuturehave been completed,FALSEif at least oneIoFuturehas been interrupted- Throws:
java.lang.InterruptedException- If one of theIoFutureis interrupted
-
awaitUninterruptibly
public static boolean awaitUninterruptibly(java.lang.Iterable<? extends IoFuture> futures, long timeout, java.util.concurrent.TimeUnit unit)
Wait on all theIoFutures we get.
-
awaitUninterruptibly
public static boolean awaitUninterruptibly(java.lang.Iterable<? extends IoFuture> futures, long timeoutMillis)
Wait on all theIoFutures we get.
-
await0
private static boolean await0(java.lang.Iterable<? extends IoFuture> futures, long timeoutMillis, boolean interruptable) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
-