V
- return type@InterfaceAudience.Private abstract class MasterCallable<V> extends Object implements RetryingCallable<V>, Closeable
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.
Modifier and Type | Field and Description |
---|---|
protected ClusterConnection |
connection |
protected MasterKeepAliveConnection |
master |
private HBaseRpcController |
rpcController |
Constructor and Description |
---|
MasterCallable(Connection connection,
RpcControllerFactory rpcConnectionFactory) |
Modifier and Type | Method and Description |
---|---|
V |
call(int callTimeout)
|
void |
close() |
String |
getExceptionMessageAdditionalDetail() |
(package private) HBaseRpcController |
getRpcController() |
private static boolean |
isMetaRegion(byte[] regionName) |
void |
prepare(boolean reload)
Prepare by setting up any connections to servers, etc., ahead of call invocation.
|
protected abstract V |
rpcCall()
Run the RPC call.
|
(package private) void |
setPriority(byte[] regionName) |
(package private) void |
setPriority(int priority) |
(package private) void |
setPriority(TableName tableName) |
long |
sleep(long pause,
int tries) |
void |
throwable(Throwable t,
boolean retrying)
Called 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.).
|
protected final ClusterConnection connection
protected MasterKeepAliveConnection master
private final HBaseRpcController rpcController
MasterCallable(Connection connection, RpcControllerFactory rpcConnectionFactory)
public void prepare(boolean reload) throws IOException
RetryingCallable
prepare
in interface RetryingCallable<V>
reload
- Set this to true if need to requery locationsIOException
- epublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void throwable(Throwable t, boolean retrying)
RetryingCallable
throwable
in interface RetryingCallable<V>
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)public String getExceptionMessageAdditionalDetail()
getExceptionMessageAdditionalDetail
in interface RetryingCallable<V>
public long sleep(long pause, int tries)
sleep
in interface RetryingCallable<V>
pause
- time to pausetries
- amount of tries until till sleeppublic V call(int callTimeout) throws IOException
Callable.call()
Exception from Exception
to
IOException
. 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.call
in interface RetryingCallable<V>
callTimeout
- - the time available for this call. 0 for infinite.IOException
protected abstract V rpcCall() throws Exception
Exception
HBaseRpcController getRpcController()
void setPriority(int priority)
void setPriority(TableName tableName)
void setPriority(byte[] regionName)
regionName
- RegionName. If hbase:meta, we'll set high priority.private static boolean isMetaRegion(byte[] regionName)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.