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 voidawait(Iterable<? extends IoFuture> futures)static booleanawait(Iterable<? extends IoFuture> futures, long timeoutMillis)static booleanawait(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit)static voidawaitUninterruptably(Iterable<? extends IoFuture> futures)Wait on all theIoFutures we get.static booleanawaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeoutMillis)Wait on all theIoFutures we get.static booleanawaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit)Wait on all theIoFutures we get.static List<WriteFuture>broadcast(Object message, Iterable<IoSession> sessions)Writes the specifiedmessageto the specifiedsessions.static List<WriteFuture>broadcast(Object message, Collection<IoSession> sessions)Writes the specifiedmessageto the specifiedsessions.static List<WriteFuture>broadcast(Object message, Iterator<IoSession> sessions)Writes the specifiedmessageto the specifiedsessions.static List<WriteFuture>broadcast(Object message, IoSession... sessions)Writes the specifiedmessageto the specifiedsessions.
-
-
-
Method Detail
-
broadcast
public static List<WriteFuture> broadcast(Object message, 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 List<WriteFuture> broadcast(Object message, 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 List<WriteFuture> broadcast(Object message, 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 List<WriteFuture> broadcast(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(Iterable<? extends IoFuture> futures) throws InterruptedException
- Parameters:
futures- TheIoFutures we are waiting on- Throws:
InterruptedException- If one of theIoFutureis interrupted
-
awaitUninterruptably
public static void awaitUninterruptably(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(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit) throws 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 oneIoFuturehaas been interrupted- Throws:
InterruptedException- If one of theIoFutureis interrupted
-
await
public static boolean await(Iterable<? extends IoFuture> futures, long timeoutMillis) throws 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:
InterruptedException- If one of theIoFutureis interrupted
-
awaitUninterruptibly
public static boolean awaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit)
Wait on all theIoFutures we get.
-
-