Class DefaultConnectFuture

    • Constructor Detail

      • DefaultConnectFuture

        public DefaultConnectFuture()
        Creates a new instance.
    • Method Detail

      • newFailedFuture

        public static ConnectFuture newFailedFuture​(Throwable exception)
        Creates a new instance of a Connection Failure, with the associated cause.
        Parameters:
        exception - The exception that caused the failure
        Returns:
        a new ConnectFuture which is already marked as 'failed to connect'.
      • getException

        public Throwable getException()
        Returns the cause of the connection failure.
        Specified by:
        getException in interface ConnectFuture
        Returns:
        null if the connect operation is not finished yet, or if the connection attempt is successful, otherwise returns the cause of the exception
      • isConnected

        public boolean isConnected()
        Specified by:
        isConnected in interface ConnectFuture
        Returns:
        true if the connect operation is finished successfully.
      • setSession

        public void setSession​(IoSession session)
        Sets the newly connected session and notifies all threads waiting for this future. This method is invoked by MINA internally. Please do not call this method directly.
        Specified by:
        setSession in interface ConnectFuture
        Parameters:
        session - The created session to store in the ConnectFuture insteance
      • setException

        public void setException​(Throwable exception)
        Sets the exception caught due to connection 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 ConnectFuture
        Parameters:
        exception - The exception to store in the ConnectFuture instance
      • cancel

        public boolean cancel()
        Cancels the connection attempt and notifies all threads waiting for this future.
        Specified by:
        cancel in interface ConnectFuture
        Returns:
        true if the future has been cancelled by this call, false if the future was already cancelled.