Class DefaultWriteFuture

    • Constructor Detail

      • DefaultWriteFuture

        public DefaultWriteFuture​(IoSession session)
        Creates a new instance.
        Parameters:
        session - The associated session
    • Method Detail

      • newWrittenFuture

        public static WriteFuture newWrittenFuture​(IoSession session)
        Returns a new DefaultWriteFuture which is already marked as 'written'.
        Parameters:
        session - The associated session
        Returns:
        A new future for a written message
      • newNotWrittenFuture

        public static WriteFuture newNotWrittenFuture​(IoSession session,
                                                      Throwable cause)
        Returns a new DefaultWriteFuture which is already marked as 'not written'.
        Parameters:
        session - The associated session
        cause - The reason why the message has not be written
        Returns:
        A new future for not written message
      • isWritten

        public boolean isWritten()
        Specified by:
        isWritten in interface WriteFuture
        Returns:
        true if the write operation is finished successfully.
      • getException

        public Throwable getException()
        Specified by:
        getException in interface WriteFuture
        Returns:
        the cause of the write failure if and only if the write operation has failed due to an Exception. Otherwise, null is returned.
      • setWritten

        public void setWritten()
        Sets the message is written, and notifies all threads waiting for this future. This method is invoked by MINA internally. Please do not call this method directly.
        Specified by:
        setWritten in interface WriteFuture
      • setException

        public void setException​(Throwable exception)
        Sets the cause of the write failure, and notifies all threads waiting for this future. This method is invoked by MINA internally. Please do not call this method directly.
        Specified by:
        setException in interface WriteFuture
        Parameters:
        exception - The exception to store in the Future instance