Class IoUtil

    • Method Detail

      • broadcast

        public static List<WriteFuture> broadcast​(Object message,
                                                  Collection<IoSession> sessions)
        Writes the specified message to the specified sessions. If the specified message is an IoBuffer, the buffer is automatically duplicated using IoBuffer.duplicate().
        Parameters:
        message - The message to broadcast
        sessions - 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 specified message to the specified sessions. If the specified message is an IoBuffer, the buffer is automatically duplicated using IoBuffer.duplicate().
        Parameters:
        message - The message to broadcast
        sessions - 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 specified message to the specified sessions. If the specified message is an IoBuffer, the buffer is automatically duplicated using IoBuffer.duplicate().
        Parameters:
        message - The message to write
        sessions - The sessions the message has to be written to
        Returns:
        The list of WriteFuture for the written messages
      • broadcast

        public static List<WriteFuture> broadcast​(Object message,
                                                  IoSession... sessions)
        Writes the specified message to the specified sessions. If the specified message is an IoBuffer, the buffer is automatically duplicated using IoBuffer.duplicate().
        Parameters:
        message - The message to write
        sessions - The sessions the message has to be written to
        Returns:
        The list of WriteFuture for the written messages
      • awaitUninterruptably

        public static void awaitUninterruptably​(Iterable<? extends IoFuture> futures)
        Wait on all the IoFutures we get. This can't get interrupted.
        Parameters:
        futures - The IoFutures we are waiting on
      • awaitUninterruptibly

        public static boolean awaitUninterruptibly​(Iterable<? extends IoFuture> futures,
                                                   long timeout,
                                                   TimeUnit unit)
        Wait on all the IoFutures we get.
        Parameters:
        futures - The IoFutures we are waiting on
        timeout - The maximum time we wait for the IoFutures to complete
        unit - The Time unit to use for the timeout
        Returns:
        TRUE if all the IoFuture have been completed, FALSE if at least one IoFuture has been interrupted
      • awaitUninterruptibly

        public static boolean awaitUninterruptibly​(Iterable<? extends IoFuture> futures,
                                                   long timeoutMillis)
        Wait on all the IoFutures we get.
        Parameters:
        futures - The IoFutures we are waiting on
        timeoutMillis - The maximum milliseconds we wait for the IoFutures to complete
        Returns:
        TRUE if all the IoFuture have been completed, FALSE if at least one IoFuture has been interrupted