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
Modifier and TypeClassDescriptionprotected final class
Node that contains a set of RemoteProceduresprivate static final class
Delayed object that holds a FutureTask.static interface
Account of what procedures are running on remote node.static class
Data structure with reference to remote operation.static interface
Remote procedure reference.private final class
-
Field Summary
Modifier and TypeFieldDescriptionprivate final int
private static final int
private static final int
private static final int
static final String
static final String
private static final org.slf4j.Logger
private final ConcurrentHashMap<TRemote,
RemoteProcedureDispatcher<TEnv, TRemote>.BufferNode> private final int
private final int
private final AtomicBoolean
static final String
private ThreadPoolExecutor
-
Constructor Summary
ModifierConstructorDescriptionprotected
RemoteProcedureDispatcher
(org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
abortPendingOperations
(TRemote key, Set<RemoteProcedureDispatcher.RemoteProcedure> operations) void
Add a node that will be able to execute remote proceduresvoid
Add 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.UncaughtExceptionHandler
boolean
void
join()
protected abstract void
remoteDispatch
(TRemote key, Set<RemoteProcedureDispatcher.RemoteProcedure> operations) void
boolean
removeNode
(TRemote key) Remove a remote nodeprotected void
boolean
start()
boolean
stop()
protected final void
submitTask
(Runnable task) protected final void
submitTask
(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:
NullTargetServerDispatchException
NoServerDispatchException
NoNodeDispatchException
-
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
-