Package org.apache.hadoop.hbase.client
Class MasterCallable<V>
java.lang.Object
org.apache.hadoop.hbase.client.MasterCallable<V>
- Type Parameters:
V- return type
- All Implemented Interfaces:
Closeable,AutoCloseable,RetryingCallable<V>
A RetryingCallable for Master RPC operations. Implement the #rpcCall method. It will be retried
on error. See its javadoc and the javadoc of #call(int). See
HBaseAdmin for examples of
how this is used. To get at the rpcController that has been created and configured to make this
rpc call, use getRpcController(). We are trying to contain all protobuf references including
references to rpcController so we don't pollute codebase with protobuf references; keep the
protobuf references contained and only present in a few classes rather than all about the code
base.
Like RegionServerCallable only in here, we can safely be PayloadCarryingRpcController all
the time. This is not possible in the similar RegionServerCallable Callable because it
has to deal with Coprocessor Endpoints.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ClusterConnectionprotected MasterKeepAliveConnectionprivate final HBaseRpcController -
Constructor Summary
ConstructorsConstructorDescriptionMasterCallable(Connection connection, RpcControllerFactory rpcConnectionFactory) -
Method Summary
Modifier and TypeMethodDescriptioncall(int callTimeout) voidclose()Returns Some details from the implementation that we would like to add to a terminating exception; i.e.(package private) HBaseRpcControllerprivate static booleanisMetaRegion(byte[] regionName) voidprepare(boolean reload) Prepare by setting up any connections to servers, etc., ahead of call invocation.protected abstract VrpcCall()Run the RPC call.(package private) voidsetPriority(byte[] regionName) (package private) voidsetPriority(int priority) (package private) voidsetPriority(TableName tableName) longsleep(long pause, int tries) Sleep and retry.voidCalled when call throws an exception and we are going to retry; take action to make it so we succeed on next call (clear caches, do relookup of locations, etc.).
-
Field Details
-
connection
-
master
-
rpcController
-
-
Constructor Details
-
MasterCallable
MasterCallable(Connection connection, RpcControllerFactory rpcConnectionFactory)
-
-
Method Details
-
prepare
Description copied from interface:RetryingCallablePrepare by setting up any connections to servers, etc., ahead of call invocation. TODO: We call prepare before EVERY call. Seems wrong. FIX!!!!- Specified by:
preparein interfaceRetryingCallable<V>- Parameters:
reload- Set this to true if need to requery locations- Throws:
IOException- e
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
throwable
Description copied from interface:RetryingCallableCalled when call throws an exception and we are going to retry; take action to make it so we succeed on next call (clear caches, do relookup of locations, etc.).- Specified by:
throwablein interfaceRetryingCallable<V>- Parameters:
t- throwable which was thrownretrying- True if we are in retrying mode (we are not in retrying mode when max retries == 1; we ARE in retrying mode if retries > 1 even when we are the last attempt)
-
getExceptionMessageAdditionalDetail
Description copied from interface:RetryingCallableReturns Some details from the implementation that we would like to add to a terminating exception; i.e. a fatal exception is being thrown ending retries and we might like to add more implementation-specific detail on to the exception being thrown.- Specified by:
getExceptionMessageAdditionalDetailin interfaceRetryingCallable<V>
-
sleep
Description copied from interface:RetryingCallableSleep and retry.- Specified by:
sleepin interfaceRetryingCallable<V>- Parameters:
pause- time to pausetries- amount of tries until till sleep- Returns:
- Suggestion on how much to sleep between retries
-
call
Override that changes theCallable.call()Exception fromExceptiontoIOException. It also does setup of an rpcController and calls through to the rpcCall() method which callers are expected to implement. If rpcController is an instance of PayloadCarryingRpcController, we will set a timeout on it.- Specified by:
callin interfaceRetryingCallable<V>- Parameters:
callTimeout- - the time available for this call. 0 for infinite.- Returns:
- computed result
- Throws:
IOException
-
rpcCall
Run the RPC call. Implement this method. To get at the rpcController that has been created and configured to make this rpc call, use getRpcController(). We are trying to contain rpcController references so we don't pollute codebase with protobuf references; keep the protobuf references contained and only present in a few classes rather than all about the code base.- Throws:
Exception
-
getRpcController
-
setPriority
-
setPriority
-
setPriority
- Parameters:
regionName- RegionName. If hbase:meta, we'll set high priority.
-
isMetaRegion
-