@InterfaceAudience.Private public class RpcRetryingCaller<T> extends Object
RetryingCallable
. Sets into rpc client
threadlocal outstanding timeouts as so we don't persist too much.
Dynamic rather than static so can set the generic appropriately.
This object has a state. It should not be used by in parallel by different threads.
Reusing it is possible however, even between multiple threads. However, the user will
have to manage the synchronization on its side: there is no synchronization inside the class.Modifier and Type | Field and Description |
---|---|
static Log |
LOG |
Constructor and Description |
---|
RpcRetryingCaller(long pause,
int retries,
int startLogErrorsCnt) |
RpcRetryingCaller(long pause,
int retries,
org.apache.hadoop.hbase.client.RetryingCallerInterceptor interceptor,
int startLogErrorsCnt) |
Modifier and Type | Method and Description |
---|---|
T |
callWithoutRetries(RetryingCallable<T> callable,
int callTimeout)
Call the server once only.
|
T |
callWithRetries(RetryingCallable<T> callable,
int callTimeout)
Retries if invocation fails.
|
void |
cancel() |
String |
toString() |
public RpcRetryingCaller(long pause, int retries, int startLogErrorsCnt)
public RpcRetryingCaller(long pause, int retries, org.apache.hadoop.hbase.client.RetryingCallerInterceptor interceptor, int startLogErrorsCnt)
public void cancel()
public T callWithRetries(RetryingCallable<T> callable, int callTimeout) throws IOException, RuntimeException
callTimeout
- Timeout for this callcallable
- The RetryingCallable
to run.IOException
- if a remote or network exception occursRuntimeException
- other unspecified errorpublic T callWithoutRetries(RetryingCallable<T> callable, int callTimeout) throws IOException, RuntimeException
RetryingCallable
has a strange shape so we can do retrys. Use this invocation if you
want to do a single call only (A call to RetryingCallable.call(int)
will not likely
succeed).IOException
- if a remote or network exception occursRuntimeException
- other unspecified error