Package one.nio.rpc

Class RpcSession<S,​M>

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class RpcSession<S,​M>
    extends Session
    • Field Detail

      • logSerialize

        protected static final org.slf4j.Logger logSerialize
      • HTTP_REQUEST_UID

        protected static final byte HTTP_REQUEST_UID
      • peer

        protected java.net.InetSocketAddress peer
      • proxyProtocol

        protected boolean proxyProtocol
      • buffer

        protected byte[] buffer
      • bytesRead

        protected int bytesRead
      • requestSize

        protected int requestSize
      • requestStartTime

        protected long requestStartTime
    • Constructor Detail

    • Method Detail

      • processRead

        protected void processRead​(byte[] unusedBuffer)
                            throws java.lang.Exception
        Overrides:
        processRead in class Session
        Throws:
        java.lang.Exception
      • parseProxyProtocol

        private void parseProxyProtocol()
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • expandBuffer

        private byte[] expandBuffer​(int requestSize)
      • readHttpHeader

        private int readHttpHeader()
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • startsWith

        private static boolean startsWith​(byte[] buffer,
                                          int from,
                                          java.lang.String s)
      • isAsyncRequest

        protected boolean isAsyncRequest​(java.lang.Object request)
      • onRequestRead

        protected M onRequestRead()
      • writeResponse

        protected int writeResponse​(java.lang.Object response)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • streamCommunicate

        protected void streamCommunicate​(StreamProxy streamProxy)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • invoke

        protected void invoke​(java.lang.Object request,
                              M meta)
                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • handleDeserializationException

        protected void handleDeserializationException​(java.lang.Exception e)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • handleRejectedExecution

        protected void handleRejectedExecution​(java.util.concurrent.RejectedExecutionException e,
                                               java.lang.Object request)
                                        throws java.io.IOException
        Throws:
        java.io.IOException