Class RetryUtils

java.lang.Object
com.hazelcast.spi.utils.RetryUtils

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

    Modifier and Type
    Method
    Description
    static <T> T
    retry(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(Callable<T> callable, int retries, List<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 Details

    • retry

      public static <T> T retry(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(Callable<T> callable, int retries, List<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.