private class RpcClientImpl.Connection.CallSender extends Thread implements Closeable
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 |
---|---|
protected BlockingQueue<RpcClientImpl.CallFuture> |
callsToWrite |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
RpcClientImpl.Connection.CallSender(String name,
org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
private void |
cleanup()
Cleans the call not yet sent when we finish.
|
void |
close() |
void |
remove(RpcClientImpl.CallFuture cts) |
void |
run()
Reads the call from the queue, write them on the socket.
|
RpcClientImpl.CallFuture |
sendCall(Call call,
int priority,
org.apache.htrace.Span span) |
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
protected final BlockingQueue<RpcClientImpl.CallFuture> callsToWrite
RpcClientImpl.Connection.CallSender(String name, org.apache.hadoop.conf.Configuration conf)
public RpcClientImpl.CallFuture sendCall(Call call, int priority, org.apache.htrace.Span span) throws InterruptedException, IOException
InterruptedException
IOException
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void remove(RpcClientImpl.CallFuture cts)
public void run()
private void cleanup()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.