mirror of
https://github.com/google/nomulus.git
synced 2025-07-22 02:36:03 +02: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:
parent
96cb9abcf3
commit
9ddde4799c
53 changed files with 495 additions and 358 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue