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 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)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.static java.util.List<WriteFuture>broadcast(java.lang.Object message, IoSession... sessions)Writes the specifiedmessageto the specifiedsessions.
-
-
-
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
-
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:
- TRUE if all the
IoFuturehave been completed, FALSE if at least oneIoFuturehaas 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:
- TRUE if all the
IoFuturehave been completed, FALSE if 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.
-
-