use of com.google.cloud.bigtable.hbase.wrappers.veneer.BigtableHBaseVeneerSettings.OperationTimeouts in project java-bigtable-hbase by googleapis.
the class DataClientVeneerApi method createScanCallContext.
// Support 2 bigtable-hbase features not directly available in veneer:
// - per attempt deadlines - vener doesn't implement deadlines for attempts. To workaround this,
// the timeouts are set per call in the ApiCallContext. However this creates a separate issue of
// over running the operation deadline, so gRPC deadline is also set.
private GrpcCallContext createScanCallContext() {
GrpcCallContext ctx = GrpcCallContext.createDefault();
OperationTimeouts callSettings = clientOperationTimeouts.getScanTimeouts();
if (callSettings.getOperationTimeout().isPresent()) {
ctx = ctx.withCallOptions(CallOptions.DEFAULT.withDeadline(Deadline.after(callSettings.getOperationTimeout().get().toMillis(), TimeUnit.MILLISECONDS)));
}
if (callSettings.getAttemptTimeout().isPresent()) {
ctx = ctx.withTimeout(callSettings.getAttemptTimeout().get());
}
return ctx;
}
use of com.google.cloud.bigtable.hbase.wrappers.veneer.BigtableHBaseVeneerSettings.OperationTimeouts in project java-bigtable-hbase by googleapis.
the class DataClientVeneerApi method createReadRowCallContext.
// Point reads are implemented using a streaming ReadRows RPC. So timeouts need to be managed
// similar to scans below.
private ApiCallContext createReadRowCallContext() {
GrpcCallContext ctx = GrpcCallContext.createDefault();
OperationTimeouts callSettings = clientOperationTimeouts.getUnaryTimeouts();
if (callSettings.getAttemptTimeout().isPresent()) {
ctx = ctx.withTimeout(callSettings.getAttemptTimeout().get());
}
// Fix it by settings the underlying grpc deadline
if (callSettings.getOperationTimeout().isPresent()) {
ctx = ctx.withCallOptions(CallOptions.DEFAULT.withDeadline(Deadline.after(callSettings.getOperationTimeout().get().toMillis(), TimeUnit.MILLISECONDS)));
}
return ctx;
}
Aggregations