@InterfaceAudience.Private public abstract class RemoteProcedureDispatcher<TEnv,TRemote extends Comparable<TRemote>> extends Object
Call start()
and then submitTask(Runnable)
. When done, call stop()
.
Modifier and Type | Class and Description |
---|---|
protected class |
RemoteProcedureDispatcher.BufferNode
Node that contains a set of RemoteProcedures
|
private static class |
RemoteProcedureDispatcher.DelayedTask
Delayed object that holds a FutureTask.
|
static interface |
RemoteProcedureDispatcher.RemoteNode<TEnv,TRemote>
Account of what procedures are running on remote node.
|
static class |
RemoteProcedureDispatcher.RemoteOperation
Data structure with reference to remote operation.
|
static interface |
RemoteProcedureDispatcher.RemoteProcedure<TEnv,TRemote>
Remote procedure reference.
|
private class |
RemoteProcedureDispatcher.TimeoutExecutorThread |
Modifier and Type | Field and Description |
---|---|
private int |
corePoolSize |
private static int |
DEFAULT_DISPATCH_DELAY |
private static int |
DEFAULT_MAX_QUEUE_SIZE |
private static int |
DEFAULT_THREAD_POOL_SIZE |
static String |
DISPATCH_DELAY_CONF_KEY |
static String |
DISPATCH_MAX_QUEUE_SIZE_CONF_KEY |
private static org.slf4j.Logger |
LOG |
private ConcurrentHashMap<TRemote,RemoteProcedureDispatcher.BufferNode> |
nodeMap |
private int |
operationDelay |
private int |
queueMaxSize |
private AtomicBoolean |
running |
static String |
THREAD_POOL_SIZE_CONF_KEY |
private ThreadPoolExecutor |
threadPool |
private RemoteProcedureDispatcher.TimeoutExecutorThread |
timeoutExecutor |
Modifier | Constructor and Description |
---|---|
protected |
RemoteProcedureDispatcher(org.apache.hadoop.conf.Configuration conf) |
private static final org.slf4j.Logger LOG
public static final String THREAD_POOL_SIZE_CONF_KEY
private static final int DEFAULT_THREAD_POOL_SIZE
public static final String DISPATCH_DELAY_CONF_KEY
private static final int DEFAULT_DISPATCH_DELAY
public static final String DISPATCH_MAX_QUEUE_SIZE_CONF_KEY
private static final int DEFAULT_MAX_QUEUE_SIZE
private final AtomicBoolean running
private final ConcurrentHashMap<TRemote extends Comparable<TRemote>,RemoteProcedureDispatcher.BufferNode> nodeMap
private final int operationDelay
private final int queueMaxSize
private final int corePoolSize
private RemoteProcedureDispatcher.TimeoutExecutorThread timeoutExecutor
private ThreadPoolExecutor threadPool
protected RemoteProcedureDispatcher(org.apache.hadoop.conf.Configuration conf)
public boolean start()
protected void setTimeoutExecutorUncaughtExceptionHandler(Thread.UncaughtExceptionHandler eh)
public boolean stop()
public void join()
protected abstract Thread.UncaughtExceptionHandler getUncaughtExceptionHandler()
public void addNode(TRemote key)
key
- the node identifierpublic void addOperationToNode(TRemote key, RemoteProcedureDispatcher.RemoteProcedure rp) throws NullTargetServerDispatchException, NoServerDispatchException, NoNodeDispatchException
key
- the node identifierNullTargetServerDispatchException
NoServerDispatchException
NoNodeDispatchException
public void removeCompletedOperation(TRemote key, RemoteProcedureDispatcher.RemoteProcedure rp)
public boolean removeNode(TRemote key)
key
- the node identifierprotected final void submitTask(Runnable task)
protected final void submitTask(Runnable task, long delay, TimeUnit unit)
protected abstract void remoteDispatch(TRemote key, Set<RemoteProcedureDispatcher.RemoteProcedure> operations)
protected abstract void abortPendingOperations(TRemote key, Set<RemoteProcedureDispatcher.RemoteProcedure> operations)
protected org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<Class<?>,RemoteProcedureDispatcher.RemoteOperation> buildAndGroupRequestByType(TEnv env, TRemote remote, Set<RemoteProcedureDispatcher.RemoteProcedure> remoteProcedures)
protected <T extends RemoteProcedureDispatcher.RemoteOperation> List<T> fetchType(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<Class<?>,RemoteProcedureDispatcher.RemoteOperation> requestByType, Class<T> type)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.