@InterfaceAudience.Private class SimpleRpcServerResponder extends Thread
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
private SimpleRpcServer |
simpleRpcServer |
private Selector |
writeSelector |
private Set<SimpleServerRpcConnection> |
writingCons |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
SimpleRpcServerResponder(SimpleRpcServer simpleRpcServer) |
Modifier and Type | Method and Description |
---|---|
private void |
doAsyncWrite(SelectionKey key) |
(package private) void |
doRespond(SimpleServerRpcConnection conn,
RpcResponse resp) |
private void |
doRunLoop() |
private boolean |
processAllResponses(SimpleServerRpcConnection connection)
Process all the responses for this connection
|
private boolean |
processResponse(SimpleServerRpcConnection conn,
RpcResponse resp)
Process the response for this call.
|
private long |
purge(long lastPurgeTime)
If there were some calls that have not been sent out for a long time, we close the connection.
|
void |
registerForWrite(SimpleServerRpcConnection c)
Add a connection to the list that want to write,
|
private void |
registerWrites()
Take the list of the connections that want to write, and register them in the selector.
|
void |
run() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
private final SimpleRpcServer simpleRpcServer
private final Selector writeSelector
private final Set<SimpleServerRpcConnection> writingCons
SimpleRpcServerResponder(SimpleRpcServer simpleRpcServer) throws IOException
IOException
private void registerWrites()
public void registerForWrite(SimpleServerRpcConnection c)
private void doRunLoop()
private long purge(long lastPurgeTime)
private void doAsyncWrite(SelectionKey key) throws IOException
IOException
private boolean processResponse(SimpleServerRpcConnection conn, RpcResponse resp) throws IOException
SimpleServerRpcConnection.responseWriteLock
IOException
private boolean processAllResponses(SimpleServerRpcConnection connection) throws IOException
IOException
void doRespond(SimpleServerRpcConnection conn, RpcResponse resp) throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.