Package com.hazelcast.spi.utils
Class RetryUtils
- java.lang.Object
-
- com.hazelcast.spi.utils.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)
Callscallable.call()
until it does not throw an exception (but no more thanretries
times).static <T> T
retry(java.util.concurrent.Callable<T> callable, int retries, java.util.List<java.lang.String> nonRetryableKeywords)
Callscallable.call()
until it does not throw an exception (but no more thanretries
times).
-
-
-
Method Detail
-
retry
public static <T> T retry(java.util.concurrent.Callable<T> callable, int retries)
Callscallable.call()
until it does not throw an exception (but no more thanretries
times).Note that
callable
should be an idempotent operation.If
callable
throws an unchecked exception, it is wrapped intoHazelcastException
.
-
retry
public static <T> T retry(java.util.concurrent.Callable<T> callable, int retries, java.util.List<java.lang.String> nonRetryableKeywords)
Callscallable.call()
until it does not throw an exception (but no more thanretries
times).Note that
callable
should be an idempotent operation.If
callable
throws an unchecked exception, it is wrapped intoHazelcastException
.
-
-