public abstract class AbstractRetryingRpcListener<RequestT,ResponseT,ResultT> extends io.grpc.ClientCall.Listener<ResponseT> implements Runnable
AsyncFunction
that retries a BigtableAsyncRpc
request.Modifier and Type | Class and Description |
---|---|
protected class |
AbstractRetryingRpcListener.GrpcFuture<RespT> |
Modifier and Type | Field and Description |
---|---|
protected io.grpc.ClientCall<RequestT,ResponseT> |
call |
protected Object |
callLock |
protected AbstractRetryingRpcListener.GrpcFuture<ResultT> |
completionFuture |
protected com.google.api.client.util.BackOff |
currentBackoff |
protected int |
failedCount |
protected static Logger |
LOG
Constant
LOG |
protected ScheduledExecutorService |
retryExecutorService |
protected RetryOptions |
retryOptions |
protected BigtableAsyncRpc<RequestT,ResponseT> |
rpc |
protected Timer.Context |
rpcTimerContext |
Constructor and Description |
---|
AbstractRetryingRpcListener(RetryOptions retryOptions,
RequestT request,
BigtableAsyncRpc<RequestT,ResponseT> retryableRpc,
io.grpc.CallOptions callOptions,
ScheduledExecutorService retryExecutorService,
io.grpc.Metadata originalMetadata)
Constructor for AbstractRetryingRpcListener.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels the RPC.
|
protected void |
cancel(String message)
Cancels the RPC with a specific message.
|
protected AbstractRetryingRpcListener.GrpcFuture<ResultT> |
createCompletionFuture() |
com.google.common.util.concurrent.ListenableFuture<ResultT> |
getCompletionFuture()
Getter for the field
completionFuture . |
protected RequestT |
getRetryRequest() |
protected boolean |
isRequestRetryable() |
void |
onClose(io.grpc.Status status,
io.grpc.Metadata trailers) |
protected abstract void |
onOK()
A subclass has the opportunity to perform the final operations it needs now that the RPC is
successfully complete.
|
void |
run()
Calls
BigtableAsyncRpc.newCall(CallOptions) and BigtableAsyncRpc.start(ClientCall, Object, io.grpc.ClientCall.Listener, Metadata) with this as
the listener so that retries happen correctly. |
protected void |
setException(Exception exception) |
void |
start()
Initial execution of the RPC.
|
protected static final Logger LOG
LOG
protected com.google.api.client.util.BackOff currentBackoff
protected final BigtableAsyncRpc<RequestT,ResponseT> rpc
protected final RetryOptions retryOptions
protected final ScheduledExecutorService retryExecutorService
protected int failedCount
protected final AbstractRetryingRpcListener.GrpcFuture<ResultT> completionFuture
protected Object callLock
protected Timer.Context rpcTimerContext
public AbstractRetryingRpcListener(RetryOptions retryOptions, RequestT request, BigtableAsyncRpc<RequestT,ResponseT> retryableRpc, io.grpc.CallOptions callOptions, ScheduledExecutorService retryExecutorService, io.grpc.Metadata originalMetadata)
Constructor for AbstractRetryingRpcListener.
retryOptions
- a RetryOptions
object.request
- a RequestT object.retryableRpc
- a BigtableAsyncRpc
object.callOptions
- a CallOptions
object.retryExecutorService
- a ScheduledExecutorService
object.originalMetadata
- a Metadata
object.protected AbstractRetryingRpcListener.GrpcFuture<ResultT> createCompletionFuture()
public void onClose(io.grpc.Status status, io.grpc.Metadata trailers)
onClose
in class io.grpc.ClientCall.Listener<ResponseT>
protected boolean isRequestRetryable()
protected void setException(Exception exception)
protected abstract void onOK()
public com.google.common.util.concurrent.ListenableFuture<ResultT> getCompletionFuture()
Getter for the field completionFuture
.
ListenableFuture
object.public void run()
Calls BigtableAsyncRpc.newCall(CallOptions)
and BigtableAsyncRpc.start(ClientCall, Object, io.grpc.ClientCall.Listener, Metadata)
with this as
the listener so that retries happen correctly.
protected RequestT getRetryRequest()
public void start()
public void cancel()
protected void cancel(String message)
message
-