Class Way

    • Constructor Summary

      Constructors 
      Constructor Description
      Way​(Connection<?> connection, int bufferSize)
      Deprecated.
      Constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean canLoop​(Buffer buffer, java.lang.Object... args)
      Deprecated.
      Indicates if the processing loop can continue.
      void clear()
      Deprecated.
      Recycles the way so it can be reused.
      protected void clearLineBuilder()
      Deprecated.
      Clears the line builder and adjust its state.
      boolean couldDrain​(Buffer buffer, java.lang.Object... args)
      Deprecated.
      Indicates if the buffer could be drained again.
      boolean couldFill​(Buffer buffer, java.lang.Object... args)
      Deprecated.
      Indicates if the buffer could be filled again.
      abstract Message getActualMessage()
      Deprecated.
      Returns the actual message, request or response.
      Buffer getBuffer()
      Deprecated.
      Returns the IO buffer.
      Connection<?> getConnection()
      Deprecated.
      Returns the parent connection.
      Series<Header> getHeaders()
      Deprecated.
      Returns the response headers.
      ConnectionHelper<?> getHelper()
      Deprecated.
      Returns the parent connector helper.
      abstract int getInterestOperations()
      Deprecated.
      Returns the operations of interest.
      IoState getIoState()
      Deprecated.
      Returns the IO state.
      java.lang.StringBuilder getLineBuilder()
      Deprecated.
      Returns the line builder.
      BufferState getLineBuilderState()
      Deprecated.
      Returns the line builder state.
      int getLoadScore()
      Deprecated.
      Returns a score representing the way load and that could be compared with other ways of the same parent connection.
      protected java.util.logging.Logger getLogger()
      Deprecated.
      Returns the logger.
      Response getMessage()
      Deprecated.
      Returns the current message processed.
      MessageState getMessageState()
      Deprecated.
      Returns the message state.
      SelectionRegistration getRegistration()
      Deprecated.
      Returns the socket's NIO registration holding the link between the channel and the connection.
      protected boolean hasIoInterest()
      Deprecated.
      Indicates if we want to be selected for IO processing when the socket related socket is prepared.
      boolean isAvailable()
      Deprecated.
      Indicates if the way is available to handle new messages.
      boolean isEmpty()
      Deprecated.
      Indicates if the way is empty.
      void onClosed()
      Deprecated.
      Callback method invoked when the parent connection is ready to be closed.
      abstract int onDrain​(Buffer buffer, int maxDrained, java.lang.Object... args)
      Deprecated.
      Drains the byte buffer by writing available bytes to the socket channel.
      abstract void onError​(Status status)
      Deprecated.
      Called on error.
      abstract int onFill​(Buffer buffer, java.lang.Object... args)
      Deprecated.
      Fills the byte buffer by writing the current message.
      protected abstract void onHeadersCompleted()
      Deprecated.
      Callback method invoked when the headers of the current message have been completely received or sent.
      void onMessageCompleted​(boolean endDetected)
      Deprecated.
      Callback method invoked when the current message has been completely received or sent.
      protected abstract void onPostProcessing()
      Deprecated.
      Called back after the IO processing to indicate if there is further IO interest.
      void onSelected​(SelectionRegistration selectionRegistration)
      Deprecated.
      Callback method invoked when the way has been selected for IO operations it registered interest in.
      abstract void onTimeOut()
      Deprecated.
      Called back by the controller when an IO time out has been detected.
      void postProcess​(int drained)
      Deprecated.
      Does nothing by default.
      int preProcess​(int maxDrained, java.lang.Object... args)
      Deprecated.
      Does nothing by default.
      protected int processIoBuffer()
      Deprecated.
      Processes the IO buffer by filling and draining it.
      protected void setHeaders​(Series<Header> headers)
      Deprecated.
      Sets the response headers to be written.
      void setIoState​(IoState ioState)
      Deprecated.
      Sets the IO state.
      protected void setLineBuilderState​(BufferState lineBuilderState)
      Deprecated.
      Sets the line builder state.
      protected void setMessage​(Response message)
      Deprecated.
      Sets the current message processed.
      protected void setMessageState​(MessageState messageState)
      Deprecated.
      Sets the message state.
      protected void setRegistration​(SelectionRegistration registration)
      Deprecated.
      Sets the NIO selection registration holding the link between the connection and the way.
      java.lang.String toString()
      Deprecated.
       
      void updateState()
      Deprecated.
      Updates the way IO and message states.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • buffer

        private final Buffer buffer
        Deprecated.
        The IO buffer.
      • connection

        private final Connection<?> connection
        Deprecated.
        The parent connection.
      • headers

        private volatile Series<Header> headers
        Deprecated.
        The message headers.
      • ioState

        private volatile IoState ioState
        Deprecated.
        The IO state.
      • lineBuilder

        private final java.lang.StringBuilder lineBuilder
        Deprecated.
        The line builder.
      • lineBuilderState

        private volatile BufferState lineBuilderState
        Deprecated.
        The line builder state.
      • message

        private volatile Response message
        Deprecated.
        The current message exchanged.
      • messageState

        private volatile MessageState messageState
        Deprecated.
        The message state.
      • registration

        private volatile SelectionRegistration registration
        Deprecated.
        The NIO selection registration.
    • Constructor Detail

      • Way

        public Way​(Connection<?> connection,
                   int bufferSize)
        Deprecated.
        Constructor.
        Parameters:
        connection - The parent connection.
        bufferSize - The byte buffer size.
    • Method Detail

      • canLoop

        public boolean canLoop​(Buffer buffer,
                               java.lang.Object... args)
        Deprecated.
        Indicates if the processing loop can continue.
        Specified by:
        canLoop in interface BufferProcessor
        Parameters:
        buffer - The IO buffer to drain.
        args - The optional arguments to pass back to the callbacks.
        Returns:
        True if the processing loop can continue.
      • clear

        public void clear()
        Deprecated.
        Recycles the way so it can be reused. Typically invoked by a connection pool.
      • clearLineBuilder

        protected void clearLineBuilder()
        Deprecated.
        Clears the line builder and adjust its state.
      • couldDrain

        public boolean couldDrain​(Buffer buffer,
                                  java.lang.Object... args)
        Deprecated.
        Indicates if the buffer could be drained again.
        Parameters:
        buffer - The IO buffer to drain.
        args - The optional arguments to pass back to the callbacks.
        Returns:
        True if the buffer could be drained again.
      • couldFill

        public boolean couldFill​(Buffer buffer,
                                 java.lang.Object... args)
        Deprecated.
        Indicates if the buffer could be filled again.
        Specified by:
        couldFill in interface BufferProcessor
        Parameters:
        buffer - The IO buffer to fill.
        args - The optional arguments to pass back to the callbacks.
        Returns:
        True if the buffer could be filled again.
      • getActualMessage

        public abstract Message getActualMessage()
        Deprecated.
        Returns the actual message, request or response.
        Returns:
        The actual message, request or response.
      • getBuffer

        public Buffer getBuffer()
        Deprecated.
        Returns the IO buffer.
        Returns:
        The IO buffer.
      • getConnection

        public Connection<?> getConnection()
        Deprecated.
        Returns the parent connection.
        Returns:
        The parent connection.
      • getHeaders

        public Series<Header> getHeaders()
        Deprecated.
        Returns the response headers.
        Returns:
        The response headers to be written.
      • getHelper

        public ConnectionHelper<?> getHelper()
        Deprecated.
        Returns the parent connector helper.
        Returns:
        The parent connector helper.
      • getInterestOperations

        public abstract int getInterestOperations()
        Deprecated.
        Returns the operations of interest.
        Returns:
        The operations of interest.
      • getIoState

        public IoState getIoState()
        Deprecated.
        Returns the IO state.
        Returns:
        The IO state.
      • getLineBuilder

        public java.lang.StringBuilder getLineBuilder()
        Deprecated.
        Returns the line builder.
        Returns:
        The line builder.
      • getLineBuilderState

        public BufferState getLineBuilderState()
        Deprecated.
        Returns the line builder state.
        Returns:
        The line builder state.
      • getLoadScore

        public int getLoadScore()
        Deprecated.
        Returns a score representing the way load and that could be compared with other ways of the same parent connection.
        Returns:
        A score representing the way load.
      • getLogger

        protected java.util.logging.Logger getLogger()
        Deprecated.
        Returns the logger.
        Returns:
        The logger.
      • getMessage

        public Response getMessage()
        Deprecated.
        Returns the current message processed.
        Returns:
        The current message processed.
      • getMessageState

        public MessageState getMessageState()
        Deprecated.
        Returns the message state.
        Returns:
        The message state.
      • getRegistration

        public SelectionRegistration getRegistration()
        Deprecated.
        Returns the socket's NIO registration holding the link between the channel and the connection.
        Returns:
        The socket's NIO registration holding the link between the channel and the connection.
      • hasIoInterest

        protected boolean hasIoInterest()
        Deprecated.
        Indicates if we want to be selected for IO processing when the socket related socket is prepared.
        Returns:
        True if we want to be selected for IO processing when the socket is ready.
      • isAvailable

        public boolean isAvailable()
        Deprecated.
        Indicates if the way is available to handle new messages.
        Returns:
        True if the way is available to handle new messages.
      • isEmpty

        public boolean isEmpty()
        Deprecated.
        Indicates if the way is empty.
        Returns:
        True if the way is empty.
      • onClosed

        public void onClosed()
        Deprecated.
        Callback method invoked when the parent connection is ready to be closed.
      • onDrain

        public abstract int onDrain​(Buffer buffer,
                                    int maxDrained,
                                    java.lang.Object... args)
                             throws java.io.IOException
        Deprecated.
        Drains the byte buffer by writing available bytes to the socket channel.
        Specified by:
        onDrain in interface BufferProcessor
        Parameters:
        buffer - The IO buffer to drain.
        maxDrained - The maximum number of bytes drained by this call.
        args - The optional arguments to pass back to the callbacks.
        Returns:
        The number of bytes drained.
        Throws:
        java.io.IOException
      • onError

        public abstract void onError​(Status status)
        Deprecated.
        Called on error.
        Parameters:
        status - The error status.
      • onFill

        public abstract int onFill​(Buffer buffer,
                                   java.lang.Object... args)
                            throws java.io.IOException
        Deprecated.
        Fills the byte buffer by writing the current message.
        Specified by:
        onFill in interface BufferProcessor
        Parameters:
        buffer - The IO buffer to drain.
        args - The optional arguments to pass back to the callbacks.
        Returns:
        The number of bytes filled.
        Throws:
        java.io.IOException
      • onHeadersCompleted

        protected abstract void onHeadersCompleted()
                                            throws java.io.IOException
        Deprecated.
        Callback method invoked when the headers of the current message have been completely received or sent.
        Throws:
        java.io.IOException
      • onMessageCompleted

        public void onMessageCompleted​(boolean endDetected)
                                throws java.io.IOException
        Deprecated.
        Callback method invoked when the current message has been completely received or sent.
        Specified by:
        onMessageCompleted in interface CompletionListener
        Parameters:
        endDetected - Indicates if the end of the socket channel was detected.
        Throws:
        java.io.IOException
      • onPostProcessing

        protected abstract void onPostProcessing()
        Deprecated.
        Called back after the IO processing to indicate if there is further IO interest. By default, it sets the IO state to IoState.INTEREST.
      • onSelected

        public void onSelected​(SelectionRegistration selectionRegistration)
        Deprecated.
        Callback method invoked when the way has been selected for IO operations it registered interest in.
        Specified by:
        onSelected in interface SelectionListener
        Parameters:
        selectionRegistration - The selected registration.
      • onTimeOut

        public abstract void onTimeOut()
        Deprecated.
        Called back by the controller when an IO time out has been detected.
      • postProcess

        public void postProcess​(int drained)
                         throws java.io.IOException
        Deprecated.
        Does nothing by default.
        Specified by:
        postProcess in interface BufferProcessor
        Parameters:
        drained - The number of bytes drained or -1 if the filling source has ended.
        Throws:
        java.io.IOException
      • preProcess

        public int preProcess​(int maxDrained,
                              java.lang.Object... args)
                       throws java.io.IOException
        Deprecated.
        Does nothing by default.
        Specified by:
        preProcess in interface BufferProcessor
        Parameters:
        maxDrained - The maximum number of bytes drained by this call or 0 for unlimited length.
        args - The optional arguments to pass back to the callbacks.
        Returns:
        The number of bytes drained or -1 if the filling source has ended.
        Throws:
        java.io.IOException
      • processIoBuffer

        protected int processIoBuffer()
                               throws java.io.IOException
        Deprecated.
        Processes the IO buffer by filling and draining it.
        Throws:
        java.io.IOException
      • setHeaders

        protected void setHeaders​(Series<Header> headers)
        Deprecated.
        Sets the response headers to be written.
        Parameters:
        headers - The response headers.
      • setIoState

        public void setIoState​(IoState ioState)
        Deprecated.
        Sets the IO state.
        Parameters:
        ioState - The IO state.
      • setLineBuilderState

        protected void setLineBuilderState​(BufferState lineBuilderState)
        Deprecated.
        Sets the line builder state.
        Parameters:
        lineBuilderState - The line builder state.
      • setMessage

        protected void setMessage​(Response message)
        Deprecated.
        Sets the current message processed.
        Parameters:
        message - The current message processed.
      • setMessageState

        protected void setMessageState​(MessageState messageState)
        Deprecated.
        Sets the message state.
        Parameters:
        messageState - The message state.
      • setRegistration

        protected void setRegistration​(SelectionRegistration registration)
        Deprecated.
        Sets the NIO selection registration holding the link between the connection and the way.
        Parameters:
        registration - The NIO selection registration holding the link between the connection and the way.
      • toString

        public java.lang.String toString()
        Deprecated.
        Overrides:
        toString in class java.lang.Object
      • updateState

        public void updateState()
        Deprecated.
        Updates the way IO and message states.