Class Retries

    • Constructor Detail

      • Retries

        public Retries()
        Deprecated.
    • Method Detail

      • callWithRetries

        public static <V> V callWithRetries​(int nAttempts,
                                            int initialRetrySec,
                                            Callable<V> action,
                                            IPredicate<Exception> retryableException)
                                     throws Exception
        Deprecated.
        Allows a client to attempt a call and retry a finite amount of times if the exception thrown is the right kind. The retries back off exponentially.
        Parameters:
        nAttempts - Number of attempts before giving up
        initialRetrySec - Number of seconds to wait before trying again on the first retry.
        action - A callable or lambda expression that contains the code that will be tried and retried, if necessary.
        retryableException - An instance of IPredicate that will be used to check if the exception caught is retryable, which can be any complex criteria that the user defines.
        Returns:
        Throws:
        Exception - If the exception isn't retryable, it's immediately thrown again. If it is retryable, then a RunTimeException is thrown after the allowed number of retries is exhausted.
      • pause

        public static void pause​(int sec)
        Deprecated.