/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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()}. */ public static List<WriteFuture> broadcast(Object message, Collection<IoSession> sessions) { List<WriteFuture> answer = new ArrayList<>(sessions.size()); 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; }
/** * 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; }
/** * {@inheritDoc} */ @Override public final Set<WriteFuture> broadcast(Object message) { // Convert to Set. We do not return a List here because only the // direct caller of MessageBroadcaster knows the order of write // operations. final List<WriteFuture> futures = IoUtil.broadcast(message, getManagedSessions().values()); return new AbstractSet<WriteFuture>() { @Override public Iterator<WriteFuture> iterator() { return futures.iterator(); } @Override public int size() { return futures.size(); } }; }
/** * {@inheritDoc} */ public final Set<WriteFuture> broadcast(Object message) { // Convert to Set. We do not return a List here because only the // direct caller of MessageBroadcaster knows the order of write // operations. final List<WriteFuture> futures = IoUtil.broadcast(message, getManagedSessions().values()); return new AbstractSet<WriteFuture>() { @Override public Iterator<WriteFuture> iterator() { return futures.iterator(); } @Override public int size() { return futures.size(); } }; }
/** * {@inheritDoc} */ @Override public final Set<WriteFuture> broadcast(Object message) { // Convert to Set. We do not return a List here because only the // direct caller of MessageBroadcaster knows the order of write // operations. final List<WriteFuture> futures = IoUtil.broadcast(message, getManagedSessions().values()); return new AbstractSet<WriteFuture>() { @Override public Iterator<WriteFuture> iterator() { return futures.iterator(); } @Override public int size() { return futures.size(); } }; }
/** * {@inheritDoc} */ @Override public final Set<WriteFuture> broadcast(Object message) { // Convert to Set. We do not return a List here because only the // direct caller of MessageBroadcaster knows the order of write // operations. final List<WriteFuture> futures = IoUtil.broadcast(message, getManagedSessions().values()); return new AbstractSet<WriteFuture>() { @Override public Iterator<WriteFuture> iterator() { return futures.iterator(); } @Override public int size() { return futures.size(); } }; }