Class GoogleCommonSafeRetry


  • public final class GoogleCommonSafeRetry
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      GoogleCommonSafeRetry​(java.lang.Integer maxWaitInterval, java.lang.Integer retryIntervalBase, java.lang.Integer jitterMultiplier, java.lang.Integer maxRetries)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <V> V doRetry​(java.util.concurrent.Callable<V> operation, java.lang.String description, java.util.List<java.lang.Integer> retryCodes, java.util.List<java.lang.Integer> successCodes, java.util.Map<java.lang.String,​java.lang.String> tags, com.netflix.spectator.api.Registry registry)
      Retry an operation if it fails.
      static GoogleCommonSafeRetry withoutDelay()
      Returns an instance of this class that never waits between retries, suitable for testing.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GoogleCommonSafeRetry

        @ParametersAreNullableByDefault
        public GoogleCommonSafeRetry​(java.lang.Integer maxWaitInterval,
                                     java.lang.Integer retryIntervalBase,
                                     java.lang.Integer jitterMultiplier,
                                     java.lang.Integer maxRetries)
    • Method Detail

      • doRetry

        @Nullable
        public <V> V doRetry​(java.util.concurrent.Callable<V> operation,
                             java.lang.String description,
                             java.util.List<java.lang.Integer> retryCodes,
                             java.util.List<java.lang.Integer> successCodes,
                             java.util.Map<java.lang.String,​java.lang.String> tags,
                             com.netflix.spectator.api.Registry registry)
                      throws GoogleApiException
        Retry an operation if it fails. Treat any error codes in successCodes as success.
        Parameters:
        operation - - The operation.
        description - - Description of the operation, used for logging.
        retryCodes - - GoogleJsonResponseException codes we retry on.
        successCodes - - GoogleJsonException codes we treat as success.
        Returns:
        Object returned from the operation.
        Throws:
        GoogleApiException