/** * Writes the specified {@code message} to the specified {@code sessions}. * If the specified {@code message} is an {@link IoBuffer}, the buffer is * automatically duplicated using {@link IoBuffer#duplicate()}. * * @param message The message to write * @param sessions The sessions the message has to be written to * @return The list of {@link WriteFuture} for the written messages */ public static List<WriteFuture> broadcast(Object message, Iterator<IoSession> sessions) { List<WriteFuture> answer = new ArrayList<>(); broadcast(message, sessions, answer); return answer; }
/** * Wait on all the {@link IoFuture}s we get, or until one of the {@link IoFuture}s is interrupted * * @param futures The {@link IoFuture}s we are waiting on * @param timeout The maximum time we wait for the {@link IoFuture}s to complete * @param unit The Time unit to use for the timeout * @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if * at least one {@link IoFuture} haas been interrupted * @throws InterruptedException If one of the {@link IoFuture} is interrupted */ public static boolean await(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit) throws InterruptedException { return await(futures, unit.toMillis(timeout)); }
/** * Wait on all the {@link IoFuture}s we get, or until one of the {@link IoFuture}s is interrupted * * @param futures The {@link IoFuture}s we are waiting on * @param timeoutMillis The maximum milliseconds we wait for the {@link IoFuture}s to complete * @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if * at least one {@link IoFuture} has been interrupted * @throws InterruptedException If one of the {@link IoFuture} is interrupted */ public static boolean await(Iterable<? extends IoFuture> futures, long timeoutMillis) throws InterruptedException { return await0(futures, timeoutMillis, true); }
/** * Wait on all the {@link IoFuture}s we get. * * @param futures The {@link IoFuture}s we are waiting on * @param timeout The maximum time we wait for the {@link IoFuture}s to complete * @param unit The Time unit to use for the timeout * @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if * at least one {@link IoFuture} has been interrupted */ public static boolean awaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit) { return awaitUninterruptibly(futures, unit.toMillis(timeout)); }
/** * Wait on all the {@link IoFuture}s we get. * * @param futures The {@link IoFuture}s we are waiting on * @param timeout The maximum time we wait for the {@link IoFuture}s to complete * @param unit The Time unit to use for the timeout * @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if * at least one {@link IoFuture} has been interrupted */ public static boolean awaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit) { return awaitUninterruptibly(futures, unit.toMillis(timeout)); }
/** * Writes the specified {@code message} to the specified {@code sessions}. * If the specified {@code message} is an {@link IoBuffer}, the buffer is * automatically duplicated using {@link IoBuffer#duplicate()}. */ public static List<WriteFuture> broadcast(Object message, Iterator<IoSession> sessions) { List<WriteFuture> answer = new ArrayList<>(); broadcast(message, sessions, answer); return answer; }
/** * Wait on all the {@link IoFuture}s we get, or until one of the {@link IoFuture}s is interrupted * * @param futures The {@link IoFuture}s we are waiting on * @param timeoutMillis The maximum milliseconds we wait for the {@link IoFuture}s to complete * @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if * at least one {@link IoFuture} has been interrupted * @throws InterruptedException If one of the {@link IoFuture} is interrupted */ public static boolean await(Iterable<? extends IoFuture> futures, long timeoutMillis) throws InterruptedException { return await0(futures, timeoutMillis, true); }
public static boolean awaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit) { return awaitUninterruptibly(futures, unit.toMillis(timeout)); }
public static boolean await(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit) throws InterruptedException { return await(futures, unit.toMillis(timeout)); }
/** * Writes the specified {@code message} to the specified {@code sessions}. * If the specified {@code message} is an {@link IoBuffer}, the buffer is * automatically duplicated using {@link IoBuffer#duplicate()}. * * @param message The message to write * @param sessions The sessions the message has to be written to * @return The list of {@link WriteFuture} for the written messages */ public static List<WriteFuture> broadcast(Object message, Iterator<IoSession> sessions) { List<WriteFuture> answer = new ArrayList<>(); broadcast(message, sessions, answer); return answer; }
public static boolean await(Iterable<? extends IoFuture> futures, long timeoutMillis) throws InterruptedException { return await0(futures, timeoutMillis, true); }
/** * Wait on all the {@link IoFuture}s we get, or until one of the {@link IoFuture}s is interrupted * * @param futures The {@link IoFuture}s we are waiting on * @param timeout The maximum time we wait for the {@link IoFuture}s to complete * @param unit The Time unit to use for the timeout * @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if * at least one {@link IoFuture} haas been interrupted * @throws InterruptedException If one of the {@link IoFuture} is interrupted */ public static boolean await(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit) throws InterruptedException { return await(futures, unit.toMillis(timeout)); }
/** * Writes the specified {@code message} to the specified {@code sessions}. * If the specified {@code message} is an {@link IoBuffer}, the buffer is * automatically duplicated using {@link IoBuffer#duplicate()}. * * @param message The message to broadcast * @param sessions The sessions that will receive the message * @return The list of WriteFuture created for each broadcasted message */ public static List<WriteFuture> broadcast(Object message, Iterable<IoSession> sessions) { List<WriteFuture> answer = new ArrayList<>(); broadcast(message, sessions.iterator(), answer); return answer; }
public static boolean awaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeoutMillis) { try { return await0(futures, timeoutMillis, false); } catch (InterruptedException e) { throw new InternalError(); } }
/** * Writes the specified {@code message} to the specified {@code sessions}. * If the specified {@code message} is an {@link IoBuffer}, the buffer is * automatically duplicated using {@link IoBuffer#duplicate()}. */ public static List<WriteFuture> broadcast(Object message, Iterable<IoSession> sessions) { List<WriteFuture> answer = new ArrayList<>(); broadcast(message, sessions.iterator(), answer); return answer; }
/** * Wait on all the {@link IoFuture}s we get. * * @param futures The {@link IoFuture}s we are waiting on * @param timeoutMillis The maximum milliseconds we wait for the {@link IoFuture}s to complete * @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if * at least one {@link IoFuture} has been interrupted */ public static boolean awaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeoutMillis) { try { return await0(futures, timeoutMillis, false); } catch (InterruptedException e) { throw new InternalError(); } }
/** * Writes the specified {@code message} to the specified {@code sessions}. * If the specified {@code message} is an {@link IoBuffer}, the buffer is * automatically duplicated using {@link IoBuffer#duplicate()}. */ public static List<WriteFuture> broadcast(Object message, Collection<IoSession> sessions) { List<WriteFuture> answer = new ArrayList<>(sessions.size()); broadcast(message, sessions.iterator(), answer); return answer; }
/** * Wait on all the {@link IoFuture}s we get. * * @param futures The {@link IoFuture}s we are waiting on * @param timeoutMillis The maximum milliseconds we wait for the {@link IoFuture}s to complete * @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if * at least one {@link IoFuture} has been interrupted */ public static boolean awaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeoutMillis) { try { return await0(futures, timeoutMillis, false); } catch (InterruptedException e) { throw new InternalError(); } }
/** * Writes the specified {@code message} to the specified {@code sessions}. * If the specified {@code message} is an {@link IoBuffer}, the buffer is * automatically duplicated using {@link IoBuffer#duplicate()}. * * @param message The message to broadcast * @param sessions The sessions that will receive the message * @return The list of WriteFuture created for each broadcasted message */ public static List<WriteFuture> broadcast(Object message, Iterable<IoSession> sessions) { List<WriteFuture> answer = new ArrayList<>(); broadcast(message, sessions.iterator(), answer); return answer; }
/** * Writes the specified {@code message} to the specified {@code sessions}. * If the specified {@code message} is an {@link IoBuffer}, the buffer is * automatically duplicated using {@link IoBuffer#duplicate()}. * * @param message The message to broadcast * @param sessions The sessions that will receive the message * @return The list of WriteFuture created for each broadcasted message */ public static List<WriteFuture> broadcast(Object message, Collection<IoSession> sessions) { List<WriteFuture> answer = new ArrayList<>(sessions.size()); broadcast(message, sessions.iterator(), answer); return answer; }