com.google.cloud.bigtable.grpc.scanner
Class RetryingReadRowsOperation
- java.lang.Object
-
- io.grpc.ClientCall.Listener<ResponseT>
-
- com.google.cloud.bigtable.grpc.async.AbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
-
- com.google.cloud.bigtable.grpc.scanner.RetryingReadRowsOperation
-
- All Implemented Interfaces:
- ScanHandler
@NotThreadSafe public class RetryingReadRowsOperation extends AbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String> implements ScanHandler
An extension ofAbstractRetryingOperation
that manages retries for the readRows streaming RPC. This class will keep track of the last returned row key viaReadRowsRequestManager
and automatically retry from the last row key .- Author:
- sduskis
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.cloud.bigtable.grpc.async.AbstractRetryingOperation
AbstractRetryingOperation.GrpcFuture<RespT>
-
-
Field Summary
-
Fields inherited from class com.google.cloud.bigtable.grpc.async.AbstractRetryingOperation
callWrapper, completionFuture, failedCount, LOG, operationSpan, operationTimerContext, retryExecutorService, retryOptions, rpc, rpcTimerContext, UNARY_DEADLINE_MINUTES
-
-
Constructor Summary
Constructors Constructor and Description RetryingReadRowsOperation(io.grpc.stub.StreamObserver<FlatRow> observer, RetryOptions retryOptions, com.google.bigtable.v2.ReadRowsRequest request, BigtableAsyncRpc<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse> retryableRpc, io.grpc.CallOptions callOptions, ScheduledExecutorService retryExecutorService, io.grpc.Metadata originalMetadata, com.google.api.core.ApiClock clock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description protected CallController<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse>
createCallController()
protected void
finalizeStats(io.grpc.Status status)
protected com.google.bigtable.v2.ReadRowsRequest
getRetryRequest()
Updates the original request viaReadRowsRequestManager.buildUpdatedRequest()
.protected boolean
isRequestRetryable()
All read rows requests are retryable.void
onClose(io.grpc.Status status, io.grpc.Metadata trailers)
void
onMessage(com.google.bigtable.v2.ReadRowsResponse message)
protected 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)
void
run()
CallsBigtableAsyncRpc.newCall(CallOptions)
andBigtableAsyncRpc.start(Object, io.grpc.ClientCall.Listener, Metadata, ClientCall)
} with this as the listener so that retries happen correctly.void
setException(Exception exception)
void
setResultObserver(io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse> resultObserver)
-
Methods inherited from class com.google.cloud.bigtable.grpc.async.AbstractRetryingOperation
cancel, cancel, getAsyncResult, getBlockingResult, getExhaustedRetriesException, getNextBackoff, getOperationCallOptions, getRpcCallOptions, getRunnable, inRetryMode, isStreamingRead, onError, resetStatusBasedBackoff
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.cloud.bigtable.grpc.scanner.ScanHandler
cancel
-
-
-
-
Constructor Detail
-
RetryingReadRowsOperation
public RetryingReadRowsOperation(io.grpc.stub.StreamObserver<FlatRow> observer, RetryOptions retryOptions, com.google.bigtable.v2.ReadRowsRequest request, BigtableAsyncRpc<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse> retryableRpc, io.grpc.CallOptions callOptions, ScheduledExecutorService retryExecutorService, io.grpc.Metadata originalMetadata, com.google.api.core.ApiClock clock)
-
-
Method Detail
-
createCallController
protected CallController<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse> createCallController()
- Overrides:
createCallController
in classAbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
-
setResultObserver
public void setResultObserver(io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse> resultObserver)
-
getRetryRequest
protected com.google.bigtable.v2.ReadRowsRequest getRetryRequest()
Updates the original request viaReadRowsRequestManager.buildUpdatedRequest()
.- Overrides:
getRetryRequest
in classAbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
-
run
public void run()
Description copied from class:AbstractRetryingOperation
CallsBigtableAsyncRpc.newCall(CallOptions)
andBigtableAsyncRpc.start(Object, io.grpc.ClientCall.Listener, Metadata, ClientCall)
} with this as the listener so that retries happen correctly.- Overrides:
run
in classAbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
-
onMessage
public void onMessage(com.google.bigtable.v2.ReadRowsResponse message)
- Overrides:
onMessage
in classio.grpc.ClientCall.Listener<com.google.bigtable.v2.ReadRowsResponse>
-
finalizeStats
protected void finalizeStats(io.grpc.Status status)
- Overrides:
finalizeStats
in classAbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
-
onClose
public void onClose(io.grpc.Status status, io.grpc.Metadata trailers)
- Overrides:
onClose
in classAbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
-
setException
public void setException(Exception exception)
- Overrides:
setException
in classAbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
-
isRequestRetryable
protected boolean isRequestRetryable()
All read rows requests are retryable.- Overrides:
isRequestRetryable
in classAbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
-
onOK
protected 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. If a subclass has to retry, due to the message, this method will return false- Specified by:
onOK
in classAbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
- Returns:
- true if the operation was really completed.
-
performRetry
protected void performRetry(long nextBackOff)
- Overrides:
performRetry
in classAbstractRetryingOperation<com.google.bigtable.v2.ReadRowsRequest,com.google.bigtable.v2.ReadRowsResponse,String>
-
-