Class IoUtil

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void await​(java.lang.Iterable<? extends IoFuture> futures)
      Wait on all the IoFutures we get, or until one of the IoFutures is interrupted
      static boolean await​(java.lang.Iterable<? extends IoFuture> futures, long timeoutMillis)
      Wait on all the IoFutures we get, or until one of the IoFutures is interrupted
      static boolean await​(java.lang.Iterable<? extends IoFuture> futures, long timeout, java.util.concurrent.TimeUnit unit)
      Wait on all the IoFutures we get, or until one of the IoFutures is interrupted
      static void awaitUninterruptably​(java.lang.Iterable<? extends IoFuture> futures)
      Wait on all the IoFutures we get.
      static boolean awaitUninterruptibly​(java.lang.Iterable<? extends IoFuture> futures, long timeoutMillis)
      Wait on all the IoFutures we get.
      static boolean awaitUninterruptibly​(java.lang.Iterable<? extends IoFuture> futures, long timeout, java.util.concurrent.TimeUnit unit)
      Wait on all the IoFutures we get.
      static java.util.List<WriteFuture> broadcast​(java.lang.Object message, java.lang.Iterable<IoSession> sessions)
      Writes the specified message to the specified sessions.
      static java.util.List<WriteFuture> broadcast​(java.lang.Object message, java.util.Collection<IoSession> sessions)
      Writes the specified message to the specified sessions.
      static java.util.List<WriteFuture> broadcast​(java.lang.Object message, java.util.Iterator<IoSession> sessions)
      Writes the specified message to the specified sessions.
      static java.util.List<WriteFuture> broadcast​(java.lang.Object message, IoSession... sessions)
      Writes the specified message to the specified sessions.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • broadcast

        public static java.util.List<WriteFuture> broadcast​(java.lang.Object message,
                                                            java.util.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 java.util.List<WriteFuture> broadcast​(java.lang.Object message,
                                                            java.lang.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 java.util.List<WriteFuture> broadcast​(java.lang.Object message,
                                                            java.util.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 java.util.List<WriteFuture> broadcast​(java.lang.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
      • await

        public static void await​(java.lang.Iterable<? extends IoFuture> futures)
                          throws java.lang.InterruptedException
        Wait on all the IoFutures we get, or until one of the IoFutures is interrupted
        Parameters:
        futures - The IoFutures we are waiting on
        Throws:
        java.lang.InterruptedException - If one of the IoFuture is interrupted
      • awaitUninterruptably

        public static void awaitUninterruptably​(java.lang.Iterable<? extends IoFuture> futures)
        Wait on all the IoFutures we get. This can't get interrupted.
        Parameters:
        futures - The IoFutures 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
        Wait on all the IoFutures we get, or until one of the IoFutures is interrupted
        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 haas been interrupted
        Throws:
        java.lang.InterruptedException - If one of the IoFuture is interrupted
      • await

        public static boolean await​(java.lang.Iterable<? extends IoFuture> futures,
                                    long timeoutMillis)
                             throws java.lang.InterruptedException
        Wait on all the IoFutures we get, or until one of the IoFutures is interrupted
        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
        Throws:
        java.lang.InterruptedException - If one of the IoFuture is interrupted
      • awaitUninterruptibly

        public static boolean awaitUninterruptibly​(java.lang.Iterable<? extends IoFuture> futures,
                                                   long timeout,
                                                   java.util.concurrent.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​(java.lang.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