/** * Cancels the RPC with a specific message. * * @param message */ protected void cancel(final String message) { callWrapper.cancel(message, null); } }
/** {@inheritDoc} */ @Override public void onMessage(ResponseT message) { callWrapper.request(1); buffer.add(message); }
if (callWrapper.isAutoFlowControlEnabled()) { callWrapper.request(1);
/** {@inheritDoc} */ @Override public void onClose(Status status, Metadata trailers) { try (Scope scope = TRACER.withSpan(operationSpan)) { callWrapper.resetCall(); rpcTimerContext.close(); // OK if (status.isOk()) { if (onOK(trailers)) { finalizeStats(status); } } else { onError(status, trailers); } } catch (Exception e) { setException(e); } }
/** * Calls {@link BigtableAsyncRpc#newCall(CallOptions)} and * {@link BigtableAsyncRpc#start(Object, io.grpc.ClientCall.Listener, Metadata, ClientCall)} } * with this as the listener so that retries happen correctly. */ protected void run() { try (Scope scope = TRACER.withSpan(operationSpan)) { rpcTimerContext = rpc.getRpcMetrics().timeRpc(); operationSpan.addAnnotation(Annotation.fromDescriptionAndAttributes("rpcStart", ImmutableMap.of("attempt", AttributeValue.longAttributeValue(failedCount)))); Metadata metadata = new Metadata(); metadata.merge(originalMetadata); callWrapper.setCallAndStart(rpc, getRpcCallOptions(), getRetryRequest(), this, metadata); } catch (Exception e) { setException(e); } }
this.clock = clock; this.exponentialRetryAlgorithm = createRetryAlgorithm(clock); this.callWrapper = new CallController<>();
@Override /** * Cancels a request on an error. * * @see com.google.cloud.bigtable.grpc.scanner.RowMerger#onError(Throwable) */ public void onError(Throwable t) { cancel("Cancelled by client with StreamObserver.onError()", t); }
@SuppressWarnings("unchecked") @Override public void run() { try { // restart the clock. super.run(); // pre-fetch one more result, for performance reasons. callWrapper.request(1); if (rowObserver instanceof ClientResponseObserver) { ((ClientResponseObserver<ReadRowsRequest, FlatRow>) rowObserver).beforeStart(callWrapper); } } catch (Exception e) { setException(e); } }