mirror of
https://github.com/google/nomulus
synced 2026-08-17 04:36:08 +00:00
Upgrade error-prone to 3.3.4 (#848)
* Upgrade error-prone to 3.3.4 This would fix the failure with openjdk 11.0.9 in 3.3.3. Fixed new antipatterns raised by the new version: - Replaced unnecessary lambdas with methods. - Switched wait/sleep calls to equivalent methods using java.time types - Types inheriting Object.toString() should not be assigned to string parameter in logging statements.
This commit is contained in:
@@ -71,7 +71,7 @@ public class Retrier implements Serializable {
|
||||
* @return the value returned by the {@link Callable}.
|
||||
*/
|
||||
public <V> V callWithRetry(Callable<V> callable, Predicate<Throwable> isRetryable) {
|
||||
return callWithRetry(callable, LOGGING_FAILURE_REPORTER, isRetryable);
|
||||
return callWithRetry(callable, Retrier::reportFailure, isRetryable);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ public class Retrier implements Serializable {
|
||||
Callable<V> callable,
|
||||
Class<? extends Throwable> retryableError,
|
||||
Class<? extends Throwable>... moreRetryableErrors) {
|
||||
return callWithRetry(callable, LOGGING_FAILURE_REPORTER, retryableError, moreRetryableErrors);
|
||||
return callWithRetry(callable, Retrier::reportFailure, retryableError, moreRetryableErrors);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,8 +171,8 @@ public class Retrier implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
private static final FailureReporter LOGGING_FAILURE_REPORTER =
|
||||
(thrown, failures, maxAttempts) ->
|
||||
logger.atInfo().withCause(thrown).log(
|
||||
"Retrying transient error, attempt %d/%d", failures, maxAttempts);
|
||||
private static void reportFailure(Throwable thrown, int failures, int maxAttempts) {
|
||||
logger.atInfo().withCause(thrown).log(
|
||||
"Retrying transient error, attempt %d/%d", failures, maxAttempts);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user