Class RemoteProcedureDispatcher<TEnv,TRemote extends Comparable<TRemote>>
java.lang.Object
org.apache.hadoop.hbase.procedure2.RemoteProcedureDispatcher<TEnv,TRemote>
- Direct Known Subclasses:
RSProcedureDispatcher
@Private
public abstract class RemoteProcedureDispatcher<TEnv,TRemote extends Comparable<TRemote>>
extends Object
A procedure dispatcher that aggregates and sends after elapsed time or after we hit count
threshold. Creates its own threadpool to run RPCs with timeout.
- Each server queue has a dispatch buffer
- Once the dispatch buffer reaches a threshold-size/time we send
Call start() and then submitTask(Runnable). When done, call stop().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected final classNode that contains a set of RemoteProceduresprivate static final classDelayed object that holds a FutureTask.static interfaceAccount of what procedures are running on remote node.static classData structure with reference to remote operation.static interfaceRemote procedure reference.private final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate static final intprivate static final intprivate static final intstatic final Stringstatic final Stringprivate static final org.slf4j.Loggerprivate final ConcurrentHashMap<TRemote,RemoteProcedureDispatcher<TEnv, TRemote>.BufferNode> private final intprivate final intprivate final AtomicBooleanstatic final Stringprivate ThreadPoolExecutor -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRemoteProcedureDispatcher(org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidabortPendingOperations(TRemote key, Set<RemoteProcedureDispatcher.RemoteProcedure> operations) voidAdd a node that will be able to execute remote proceduresvoidAdd a remote rpc.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) protected abstract Thread.UncaughtExceptionHandlerbooleanvoidjoin()protected abstract voidremoteDispatch(TRemote key, Set<RemoteProcedureDispatcher.RemoteProcedure> operations) voidbooleanremoveNode(TRemote key) Remove a remote nodeprotected voidbooleanstart()booleanstop()protected final voidsubmitTask(Runnable task) protected final voidsubmitTask(Runnable task, long delay, TimeUnit unit)
-
Field Details
-
LOG
-
THREAD_POOL_SIZE_CONF_KEY
- See Also:
-
DEFAULT_THREAD_POOL_SIZE
- See Also:
-
DISPATCH_DELAY_CONF_KEY
- See Also:
-
DEFAULT_DISPATCH_DELAY
- See Also:
-
DISPATCH_MAX_QUEUE_SIZE_CONF_KEY
- See Also:
-
DEFAULT_MAX_QUEUE_SIZE
- See Also:
-
running
-
nodeMap
private final ConcurrentHashMap<TRemote extends Comparable<TRemote>,RemoteProcedureDispatcher<TEnv, nodeMapTRemote extends Comparable<TRemote>>.BufferNode> -
operationDelay
-
queueMaxSize
-
corePoolSize
-
timeoutExecutor
private RemoteProcedureDispatcher<TEnv,TRemote extends Comparable<TRemote>>.TimeoutExecutorThread timeoutExecutor -
threadPool
-
-
Constructor Details
-
RemoteProcedureDispatcher
-
-
Method Details
-
start
-
setTimeoutExecutorUncaughtExceptionHandler
-
stop
-
join
-
getUncaughtExceptionHandler
-
addNode
Add a node that will be able to execute remote procedures- Parameters:
key- the node identifier
-
addOperationToNode
public void addOperationToNode(TRemote key, RemoteProcedureDispatcher.RemoteProcedure rp) throws NullTargetServerDispatchException, NoServerDispatchException, NoNodeDispatchException Add a remote rpc.- Parameters:
key- the node identifier- Throws:
NullTargetServerDispatchExceptionNoServerDispatchExceptionNoNodeDispatchException
-
removeCompletedOperation
-
removeNode
Remove a remote node- Parameters:
key- the node identifier
-
submitTask
-
submitTask
-
remoteDispatch
protected abstract void remoteDispatch(TRemote key, Set<RemoteProcedureDispatcher.RemoteProcedure> operations) -
abortPendingOperations
protected abstract void abortPendingOperations(TRemote key, Set<RemoteProcedureDispatcher.RemoteProcedure> operations) -
buildAndGroupRequestByType
protected org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<Class<?>,RemoteProcedureDispatcher.RemoteOperation> buildAndGroupRequestByType(TEnv env, TRemote remote, Set<RemoteProcedureDispatcher.RemoteProcedure> remoteProcedures) -
fetchType
protected <T extends RemoteProcedureDispatcher.RemoteOperation> List<T> fetchType(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<Class<?>, RemoteProcedureDispatcher.RemoteOperation> requestByType, Class<T> type) -
hasNode
-