.setRetryableCodes(settings.readRowsSettings().getRetryableCodes()) .setRetrySettings(settings.readRowsSettings().getRetrySettings()) .setResumptionStrategy(settings.readRowsSettings().getResumptionStrategy()) .setIdleTimeout(settings.readRowsSettings().getIdleTimeout());
@BetaApi("The surface for streaming is not stable yet and may change in the future.") public static <RequestT, ResponseT> ServerStreamingCallable<RequestT, ResponseT> retrying( ServerStreamingCallable<RequestT, ResponseT> innerCallable, ServerStreamingCallSettings<RequestT, ResponseT> callSettings, ClientContext clientContext) { if (callSettings.getRetryableCodes().isEmpty()) { return innerCallable; } StreamingRetryAlgorithm<Void> retryAlgorithm = new StreamingRetryAlgorithm<>( new ApiResultRetryAlgorithm<Void>(), new ExponentialRetryAlgorithm( callSettings.getRetrySettings(), clientContext.getClock())); ScheduledRetryingExecutor<Void> retryingExecutor = new ScheduledRetryingExecutor<>(retryAlgorithm, clientContext.getExecutor()); return new RetryingServerStreamingCallable<>( innerCallable, retryingExecutor, callSettings.getResumptionStrategy()); }
@BetaApi("The surface for streaming is not stable yet and may change in the future.") public static <RequestT, ResponseT> ServerStreamingCallable<RequestT, ResponseT> retrying( ServerStreamingCallable<RequestT, ResponseT> innerCallable, ServerStreamingCallSettings<RequestT, ResponseT> callSettings, ClientContext clientContext) { if (callSettings.getRetryableCodes().isEmpty()) { return innerCallable; } StreamingRetryAlgorithm<Void> retryAlgorithm = new StreamingRetryAlgorithm<>( new ApiResultRetryAlgorithm<Void>(), new ExponentialRetryAlgorithm( callSettings.getRetrySettings(), clientContext.getClock())); ScheduledRetryingExecutor<Void> retryingExecutor = new ScheduledRetryingExecutor<>(retryAlgorithm, clientContext.getExecutor()); return new RetryingServerStreamingCallable<>( innerCallable, retryingExecutor, callSettings.getResumptionStrategy()); }