Class AbstractConnection

    • Constructor Detail

      • AbstractConnection

        protected AbstractConnection​(EndPoint endp,
                                     java.util.concurrent.Executor executor)
    • Method Detail

      • addEventListener

        public void addEventListener​(java.util.EventListener listener)
        Description copied from interface: Connection

        Adds a listener of connection events.

        Specified by:
        addEventListener in interface Connection
        Parameters:
        listener - the listener to add
      • removeEventListener

        public void removeEventListener​(java.util.EventListener listener)
        Description copied from interface: Connection

        Removes a listener of connection events.

        Specified by:
        removeEventListener in interface Connection
        Parameters:
        listener - the listener to remove
      • getInputBufferSize

        public int getInputBufferSize()
      • setInputBufferSize

        public void setInputBufferSize​(int inputBufferSize)
      • getExecutor

        protected java.util.concurrent.Executor getExecutor()
      • failedCallback

        protected void failedCallback​(Callback callback,
                                      java.lang.Throwable x)
      • tryFillInterested

        public void tryFillInterested()
      • tryFillInterested

        public void tryFillInterested​(Callback callback)
      • isFillInterested

        public boolean isFillInterested()
      • onFillable

        public abstract void onFillable()

        Callback method invoked when the endpoint is ready to be read.

        See Also:
        fillInterested()
      • onFillInterestedFailed

        protected void onFillInterestedFailed​(java.lang.Throwable cause)

        Callback method invoked when the endpoint failed to be ready to be read.

        Parameters:
        cause - the exception that caused the failure
      • onReadTimeout

        protected boolean onReadTimeout​(java.lang.Throwable timeout)

        Callback method invoked when the endpoint failed to be ready to be read after a timeout

        Parameters:
        timeout - the cause of the read timeout
        Returns:
        true to signal that the endpoint must be closed, false to keep the endpoint open
      • onOpen

        public void onOpen()
        Description copied from interface: Connection

        Callback method invoked when this connection is opened.

        Creators of the connection implementation are responsible for calling this method.

        Specified by:
        onOpen in interface Connection
      • onClose

        public void onClose​(java.lang.Throwable cause)
        Description copied from interface: Connection

        Callback method invoked when this connection is closed.

        Creators of the connection implementation are responsible for calling this method.

        Specified by:
        onClose in interface Connection
        Parameters:
        cause - The cause of the close or null for a normal close
      • close

        public void close()
        Description copied from interface: Connection

        Performs a logical close of this connection.

        For simple connections, this may just mean to delegate the close to the associated EndPoint but, for example, SSL connections should write the SSL close message before closing the associated EndPoint.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface Connection
      • onIdleExpired

        public boolean onIdleExpired()
        Description copied from interface: Connection

        Callback method invoked upon an idle timeout event.

        Implementations of this method may return true to indicate that the idle timeout handling should proceed normally, typically failing the EndPoint and causing it to be closed.

        When false is returned, the handling of the idle timeout event is halted immediately and the EndPoint left in the state it was before the idle timeout event.

        Specified by:
        onIdleExpired in interface Connection
        Returns:
        true to let the EndPoint handle the idle timeout, false to tell the EndPoint to halt the handling of the idle timeout.
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toConnectionString

        public java.lang.String toConnectionString()