google-nomulus/java/google/registry/util
guyben 552940a816 Remove the reduntant 'afterFinalFailure' from Retrier
'afterFinalFailure' is called just before rethrowing a non-retrying error from
the retrier. This can happen either because the exception shouldn't be retried,
or because we exceeded the maximum number of retries.

The same thing can be done by catching that thrown error outside of the
retrier:

retrier.callWithRetry(
  callable,
  new FailureReporter() {
    @Override
    void afterFinalFailure(Throwable thrown, int failures) {
      // do something with thrown
    }
  },
  RetriableException.class);

is (almost) the same as:

try {
  retrier.callWithRetry(callable, RetriableException.class);
} catch (Throwable thrown) {
  // do something with thrown
  throw thrown;
}

("almost" because the retrier might wrap the Throwable in a RuntimeException,
so you might need to getCause or getRootCause. Also - there is the
"beforeRetry" I ignored for the example)

Removing "afterFinalFailure" also makes the FailureReporter in line with Java 8
functional interface - meaning we can more easily create it when we do need to
override "beforeRetry".

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189972101
2018-04-02 16:26:19 -04:00
..
AppEngineTimeLimiter.java Fix mismatch in types of Predicates being used 2017-10-04 16:16:45 -04:00
BUILD Add //third_party/java/jaxb dependency to targets using javax.xml.bind 2018-01-23 16:18:35 -05:00
CapturingLogHandler.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
CidrAddressBlock.java Rationalize logging statements across codebase 2018-01-19 14:56:45 -05:00
Clock.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
CollectionUtils.java Remove unnecessary generic type arguments 2017-11-21 18:17:31 -05:00
ComparingInvocationHandler.java Fix two warnings thrown by Eclipse 2017-04-26 10:36:51 -04:00
Concurrent.java Replace com.google.common.base.Function with java.util.function.Function 2017-12-27 11:08:55 -05:00
DatastoreServiceUtils.java Refactor Guava functional methods to use lambdas 2017-12-01 22:14:05 -05:00
DateTimeUtils.java Refer to Datastore everywhere correctly by its capitalized form 2017-02-17 12:12:12 -05:00
DiffUtils.java Migrate Guava Predicates.notNull to Objects.nonNull 2017-12-27 11:19:53 -05:00
DomainNameUtils.java Add sharded DNS publishing capability 2018-03-06 19:14:26 -05:00
FixedClock.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
FormattingLogger.java Rationalize logging statements across codebase 2018-01-19 14:56:45 -05:00
HexDumper.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
Idn.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
ImprovedInputStream.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
ImprovedOutputStream.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
ListNamingUtils.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
NetworkUtils.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
NonFinalForTesting.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
package-info.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
PipelineUtils.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
PosixTarHeader.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
PreconditionsUtils.java Switch from Guava Optionals to Java 8 Optionals 2017-10-24 16:53:47 -04:00
PredicateUtils.java Replace com.google.common.base.Predicate with java.util.function.Predicate 2017-12-27 11:21:28 -05:00
RandomStringGenerator.java Create GenerateAllocationTokens nomulus tool command 2018-01-19 14:26:56 -05:00
RegistrarUtils.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
RequestStatusChecker.java Clean up some code quality issues 2017-12-01 22:14:06 -05:00
RequestStatusCheckerImpl.java Add unit tests to RequestStatusCheckerImpl 2017-09-12 15:51:50 -04:00
ResourceUtils.java Add golden files for request component routing maps 2017-06-05 18:17:09 -04:00
Retrier.java Remove the reduntant 'afterFinalFailure' from Retrier 2018-04-02 16:26:19 -04:00
SendEmailService.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
SerializeUtils.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
Sleeper.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
SqlTemplate.java Remove unnecessary generic type arguments 2017-11-21 18:17:31 -05:00
StringGenerator.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
SystemClock.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
SystemSleeper.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
TaskEnqueuer.java Run automatic Java 8 conversion over codebase 2017-10-10 12:09:41 -04:00
TeeOutputStream.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
TokenUtils.java Clean up some code quality issues 2017-12-01 22:14:06 -05:00
TypeUtils.java Clean up some code quality issues 2017-12-01 22:14:06 -05:00
UrlFetchException.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
UrlFetchUtils.java Switch from Guava Optionals to Java 8 Optionals 2017-10-24 16:53:47 -04:00
VoidCallable.java Clean up some code quality issues 2017-12-01 22:14:06 -05:00
X509Utils.java Remove unnecessary generic type arguments 2017-11-21 18:17:31 -05:00
XmlEnumUtils.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
XmlToEnumMapper.java Remove unnecessary explicit generic type declarations 2017-11-07 17:11:29 -05:00