Package one.nio.rpc
Class RpcSession<S,M>
- java.lang.Object
-
- one.nio.net.Session
-
- one.nio.rpc.RpcSession<S,M>
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class RpcSession<S,M> extends Session
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class one.nio.net.Session
Session.ArrayQueueItem, Session.QueueItem
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]bufferprotected static intBUFFER_SIZEprotected intbytesReadprotected static byteHTTP_REQUEST_UIDprotected InetSocketAddresspeerprotected booleanproxyProtocolprotected intrequestSizeprotected longrequestStartTimeprotected RpcServer<S>server-
Fields inherited from class one.nio.net.Session
ACTIVE, closing, CLOSING, EVENT_MASK, events, eventsToListen, IDLE, lastAccessTime, log, queueHead, READABLE, selector, slot, socket, SSL, STALE, wasSelected, WRITEABLE
-
-
Constructor Summary
Constructors Constructor Description RpcSession(Socket socket, RpcServer<S> server)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidhandleDeserializationException(Exception e)protected voidhandleRejectedExecution(RejectedExecutionException e, Object request)protected voidinvoke(Object request, M meta)protected booleanisAsyncRequest(Object request)protected MonRequestRead()protected voidprocessRead(byte[] unusedBuffer)protected voidstreamCommunicate(StreamProxy streamProxy)protected intwriteResponse(Object response)-
Methods inherited from class one.nio.net.Session
checkStatus, close, getQueueStats, getRemoteHost, handleException, isSsl, lastAccessTime, listen, process, processWrite, read, readRaw, scheduleClose, socket, write, write, write
-
-
-
-
Field Detail
-
BUFFER_SIZE
protected static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
HTTP_REQUEST_UID
protected static final byte HTTP_REQUEST_UID
-
peer
protected InetSocketAddress peer
-
proxyProtocol
protected boolean proxyProtocol
-
buffer
protected byte[] buffer
-
bytesRead
protected int bytesRead
-
requestSize
protected int requestSize
-
requestStartTime
protected long requestStartTime
-
-
Method Detail
-
processRead
protected void processRead(byte[] unusedBuffer) throws Exception- Overrides:
processReadin classSession- Throws:
Exception
-
isAsyncRequest
protected boolean isAsyncRequest(Object request)
-
onRequestRead
protected M onRequestRead()
-
writeResponse
protected int writeResponse(Object response) throws IOException
- Throws:
IOException
-
streamCommunicate
protected void streamCommunicate(StreamProxy streamProxy) throws IOException
- Throws:
IOException
-
handleDeserializationException
protected void handleDeserializationException(Exception e) throws IOException
- Throws:
IOException
-
handleRejectedExecution
protected void handleRejectedExecution(RejectedExecutionException e, Object request) throws IOException
- Throws:
IOException
-
-