/** * {@inheritDoc} * * <p>The attempt settings will be reset if the stream attempt produced any messages. */ @Override public TimedAttemptSettings createNextAttempt( Throwable prevThrowable, ResponseT prevResponse, TimedAttemptSettings prevSettings) { if (prevThrowable instanceof ServerStreamingAttemptException) { ServerStreamingAttemptException attemptException = (ServerStreamingAttemptException) prevThrowable; prevThrowable = prevThrowable.getCause(); // If we have made progress in the last attempt, then reset the delays if (attemptException.hasSeenResponses()) { prevSettings = createFirstAttempt() .toBuilder() .setFirstAttemptStartTimeNanos(prevSettings.getFirstAttemptStartTimeNanos()) .setOverallAttemptCount(prevSettings.getOverallAttemptCount()) .build(); } } return super.createNextAttempt(prevThrowable, prevResponse, prevSettings); }
/** * {@inheritDoc} * * <p>The attempt settings will be reset if the stream attempt produced any messages. */ @Override public TimedAttemptSettings createNextAttempt( Throwable prevThrowable, ResponseT prevResponse, TimedAttemptSettings prevSettings) { if (prevThrowable instanceof ServerStreamingAttemptException) { ServerStreamingAttemptException attemptException = (ServerStreamingAttemptException) prevThrowable; prevThrowable = prevThrowable.getCause(); // If we have made progress in the last attempt, then reset the delays if (attemptException.hasSeenResponses()) { prevSettings = createFirstAttempt() .toBuilder() .setFirstAttemptStartTimeNanos(prevSettings.getFirstAttemptStartTimeNanos()) .setOverallAttemptCount(prevSettings.getOverallAttemptCount()) .build(); } } return super.createNextAttempt(prevThrowable, prevResponse, prevSettings); }
retryAlgorithm.createNextAttempt(throwable, response, attemptSettings); boolean shouldRetry = retryAlgorithm.shouldRetry(throwable, response, nextAttemptSettings); if (shouldRetry) {
retryAlgorithm.createNextAttempt(throwable, response, attemptSettings); boolean shouldRetry = retryAlgorithm.shouldRetry(throwable, response, nextAttemptSettings); if (shouldRetry) {