Package io.confluent.license.util
Class RetryUtil
java.lang.Object
io.confluent.license.util.RetryUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TretryUntilTimeout(Callable<T> callable, Supplier<String> description, Duration timeoutDuration, long retryBackoffMs) The method executes the callable at least once, optionally retrying the callable ifRetriableExceptionis being thrown.
-
Constructor Details
-
RetryUtil
public RetryUtil()
-
-
Method Details
-
retryUntilTimeout
public static <T> T retryUntilTimeout(Callable<T> callable, Supplier<String> description, Duration timeoutDuration, long retryBackoffMs) throws Exception The method executes the callable at least once, optionally retrying the callable ifRetriableExceptionis being thrown. If timeout is exhausted, then the last exception is wrapped with aConnectExceptionand thrown.descriptionsupplies the message that indicates the purpose of the callable since the message will be used for logging. For example, "list offsets". If the supplier is null or the supplied string is null,callablewill be used as the default string.The task will be executed at least once. No retries will be performed if
timeoutDurationis 0 or negative, or iftimeoutDurationis less thanretryBackoffMs.A
retryBackoffMsthat is negative or zero will result in no delays between retries.- Parameters:
callable- the function to executedescription- supplier that provides custom message for logging purposetimeoutDuration- timeout duration; must not be nullretryBackoffMs- the number of milliseconds to delay upon receiving aRetriableExceptionbefore retrying again- Throws:
org.apache.kafka.connect.errors.ConnectException- If the task exhausted all the retriesException
-