private class BlockingRpcConnection.CallSender extends Thread
The implementation is simple: the client threads adds their call to the queue, and then wait for an answer. The CallSender blocks on the queue, and writes the calls one after the other. On interruption, the client cancels its call. The CallSender checks that the call has not been canceled before writing it.
When the connection closes, all the calls not yet sent are dismissed. The client thread is notified with an appropriate exception, as if the call was already sent but the answer not yet received.Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
private Queue<Call> |
callsToWrite |
private int |
maxQueueSize |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
CallSender(String name,
org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
void |
cleanup(IOException e)
Cleans the call not yet sent when we finish.
|
void |
remove(Call call) |
void |
run()
Reads the call from the queue, write them on the socket.
|
void |
sendCall(Call call) |
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 Queue<Call> callsToWrite
private final int maxQueueSize
public CallSender(String name, org.apache.hadoop.conf.Configuration conf)
public void sendCall(Call call) throws IOException
IOException
public void run()
public void cleanup(IOException e)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.