Class RetryUtils
- java.lang.Object
-
- org.apache.flink.cdc.connectors.maxcompute.utils.RetryUtils
-
public class RetryUtils extends Object
Retry utilities to execute a callable with specific retry times. Set MAX_RETRIES and RETRY_DELAY at the start ofMaxComputeEventSink.
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.LoggerLOG
-
Constructor Summary
Constructors Constructor Description RetryUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Texecute(Callable<T> callable)Executes a callable with default retry strategy.static <T> Texecute(Callable<T> callable, int maxRetries, long retryDelay)Executes a callable with specific retry strategy.static <T> TexecuteUnchecked(Callable<T> callable)Executes a callable with default retry strategy and unchecked exceptions.static <T> TexecuteUnchecked(Callable<T> callable, int maxRetries, long retryDelay)Executes a callable with specific retry strategy and unchecked exceptions.static org.apache.flink.cdc.connectors.maxcompute.utils.RetryUtils.RetryLoggergetRetryLogger()
-
-
-
Method Detail
-
getRetryLogger
public static org.apache.flink.cdc.connectors.maxcompute.utils.RetryUtils.RetryLogger getRetryLogger()
-
execute
public static <T> T execute(Callable<T> callable) throws IOException
Executes a callable with default retry strategy.- Type Parameters:
T- the type of the task's result- Parameters:
callable- the task to be executed- Returns:
- the task result
- Throws:
IOException- If the task fails after all retries
-
execute
public static <T> T execute(Callable<T> callable, int maxRetries, long retryDelay) throws IOException
Executes a callable with specific retry strategy.- Type Parameters:
T- the type of the task's result- Parameters:
callable- the task to be executedmaxRetries- the maximum number of retriesretryDelay- the delay between retries in milliseconds- Returns:
- the task result
- Throws:
IOException- If the task fails after all retries
-
executeUnchecked
public static <T> T executeUnchecked(Callable<T> callable)
Executes a callable with default retry strategy and unchecked exceptions.- Type Parameters:
T- the type of the task's result- Parameters:
callable- the task to be executed- Returns:
- the task result
-
executeUnchecked
public static <T> T executeUnchecked(Callable<T> callable, int maxRetries, long retryDelay)
Executes a callable with specific retry strategy and unchecked exceptions.- Type Parameters:
T- the type of the task's result- Parameters:
callable- the task to be executedmaxRetries- the maximum number of retriesretryDelay- the delay between retries in milliseconds- Returns:
- the task result
-
-