@InterfaceAudience.Private @InterfaceStability.Evolving public abstract class RpcExecutor extends Object
Modifier and Type | Class and Description |
---|---|
static class |
RpcExecutor.QueueBalancer |
private static class |
RpcExecutor.RandomQueueBalancer
Queue balancer that just randomly selects a queue in the range [0, num queues).
|
Modifier and Type | Field and Description |
---|---|
private Abortable |
abortable |
private AtomicInteger |
activeHandlerCount |
private org.apache.hadoop.conf.Configuration |
conf |
private AtomicInteger |
failedHandlerCount |
private int |
handlerCount |
private List<Thread> |
handlers |
private static org.apache.commons.logging.Log |
LOG |
private String |
name |
private static RpcExecutor.QueueBalancer |
ONE_QUEUE
All requests go to the first queue, at index 0
|
private boolean |
running |
Constructor and Description |
---|
RpcExecutor(String name,
int handlerCount) |
RpcExecutor(String name,
int handlerCount,
org.apache.hadoop.conf.Configuration conf,
Abortable abortable) |
Modifier and Type | Method and Description |
---|---|
protected void |
consumerLoop(BlockingQueue<CallRunner> myQueue) |
abstract boolean |
dispatch(CallRunner callTask)
Add the request to the executor queue
|
int |
getActiveHandlerCount() |
static RpcExecutor.QueueBalancer |
getBalancer(int queueSize) |
abstract int |
getQueueLength()
Returns the length of the pending queue
|
protected abstract List<BlockingQueue<CallRunner>> |
getQueues()
Returns the list of request queues
|
void |
start(int port) |
protected void |
startHandlers(int port) |
protected void |
startHandlers(String nameSuffix,
int numHandlers,
List<BlockingQueue<CallRunner>> callQueues,
int qindex,
int qsize,
int port) |
void |
stop() |
private static final org.apache.commons.logging.Log LOG
private final AtomicInteger activeHandlerCount
private final int handlerCount
private final String name
private final AtomicInteger failedHandlerCount
private boolean running
private org.apache.hadoop.conf.Configuration conf
private Abortable abortable
private static RpcExecutor.QueueBalancer ONE_QUEUE
public RpcExecutor(String name, int handlerCount)
public void start(int port)
public void stop()
public int getActiveHandlerCount()
public abstract int getQueueLength()
public abstract boolean dispatch(CallRunner callTask) throws InterruptedException
InterruptedException
protected abstract List<BlockingQueue<CallRunner>> getQueues()
protected void startHandlers(int port)
protected void startHandlers(String nameSuffix, int numHandlers, List<BlockingQueue<CallRunner>> callQueues, int qindex, int qsize, int port)
protected void consumerLoop(BlockingQueue<CallRunner> myQueue)
public static RpcExecutor.QueueBalancer getBalancer(int queueSize)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.