public abstract class AbstractRetryingOperation<RequestT,ResponseT,ResultT>
extends io.grpc.ClientCall.Listener<ResponseT>
ClientCall.Listener
that retries a BigtableAsyncRpc
request.Modifier and Type | Class and Description |
---|---|
protected class |
AbstractRetryingOperation.GrpcFuture<RespT> |
Modifier and Type | Field and Description |
---|---|
protected io.grpc.ClientCall<RequestT,ResponseT> |
call |
protected Object |
callLock |
protected AbstractRetryingOperation.GrpcFuture<ResultT> |
completionFuture |
protected com.google.api.client.util.BackOff |
currentBackoff |
protected int |
failedCount |
protected static Logger |
LOG
Constant
LOG |
protected io.opencensus.trace.Span |
operationSpan |
protected Timer.Context |
operationTimerContext |
protected ScheduledExecutorService |
retryExecutorService |
protected RetryOptions |
retryOptions |
protected BigtableAsyncRpc<RequestT,ResponseT> |
rpc |
protected Timer.Context |
rpcTimerContext |
protected static long |
UNARY_DEADLINE_MINUTES |
Constructor and Description |
---|
AbstractRetryingOperation(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 void |
finalizeStats(io.grpc.Status status) |
com.google.common.util.concurrent.ListenableFuture<ResultT> |
getAsyncResult()
Initial execution of the RPC.
|
ResultT |
getBlockingResult() |
protected io.grpc.CallOptions |
getCallOptions() |
protected BigtableRetriesExhaustedException |
getExhaustedRetriesException(io.grpc.Status status) |
protected long |
getNextBackoff() |
RequestT |
getOriginalRequest() |
protected RequestT |
getRetryRequest() |
protected Runnable |
getRunnable() |
protected boolean |
isRequestRetryable() |
void |
onClose(io.grpc.Status status,
io.grpc.Metadata trailers) |
protected void |
onError(io.grpc.Status status,
io.grpc.Metadata trailers) |
protected abstract boolean |
onOK(io.grpc.Metadata trailers)
A subclass has the opportunity to perform the final operations it needs now that the RPC is
successfully complete.
|
protected void |
performRetry(long nextBackOff) |
protected void |
run()
Calls
BigtableAsyncRpc.newCall(CallOptions) and
BigtableAsyncRpc.start(Object, io.grpc.ClientCall.Listener, Metadata, ClientCall) }
with this as the listener so that retries happen correctly. |
protected void |
setException(Exception exception) |
protected static final Logger LOG
LOG
protected static final long UNARY_DEADLINE_MINUTES
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 AbstractRetryingOperation.GrpcFuture<ResultT> completionFuture
protected Object callLock
protected Timer.Context operationTimerContext
protected Timer.Context rpcTimerContext
protected final io.opencensus.trace.Span operationSpan
public AbstractRetryingOperation(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.public void onClose(io.grpc.Status status, io.grpc.Metadata trailers)
onClose
in class io.grpc.ClientCall.Listener<ResponseT>
protected void finalizeStats(io.grpc.Status status)
protected void onError(io.grpc.Status status, io.grpc.Metadata trailers)
protected BigtableRetriesExhaustedException getExhaustedRetriesException(io.grpc.Status status)
protected void performRetry(long nextBackOff)
protected Runnable getRunnable()
protected boolean isRequestRetryable()
protected void setException(Exception exception)
protected abstract boolean onOK(io.grpc.Metadata trailers)
protected long getNextBackoff()
protected void run()
BigtableAsyncRpc.newCall(CallOptions)
and
BigtableAsyncRpc.start(Object, io.grpc.ClientCall.Listener, Metadata, ClientCall)
}
with this as the listener so that retries happen correctly.protected io.grpc.CallOptions getCallOptions()
protected RequestT getRetryRequest()
public final RequestT getOriginalRequest()
public com.google.common.util.concurrent.ListenableFuture<ResultT> getAsyncResult()
public void cancel()
public ResultT getBlockingResult()
protected void cancel(String message)
message
-