Class RetryUtils


  • public final class RetryUtils
    extends java.lang.Object
    Static utility class to retry operations.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T retry​(java.util.concurrent.Callable<T> callable, int retries)
      Calls callable.call() until it does not throw an exception (but no more than retries times).
      static <T> T retry​(java.util.concurrent.Callable<T> callable, int retries, java.util.List<java.lang.String> nonRetryableKeywords)
      Calls callable.call() until it does not throw an exception (but no more than retries times).
      • Methods inherited from class java.lang.Object

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

      • retry

        public static <T> T retry​(java.util.concurrent.Callable<T> callable,
                                  int retries)
        Calls callable.call() until it does not throw an exception (but no more than retries times).

        Note that callable should be an idempotent operation.

        If callable throws an unchecked exception, it is wrapped into HazelcastException.

      • retry

        public static <T> T retry​(java.util.concurrent.Callable<T> callable,
                                  int retries,
                                  java.util.List<java.lang.String> nonRetryableKeywords)
        Calls callable.call() until it does not throw an exception (but no more than retries times).

        Note that callable should be an idempotent operation.

        If callable throws an unchecked exception, it is wrapped into HazelcastException.