Class 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 of MaxComputeEventSink.
    • Field Detail

      • LOG

        public static final org.slf4j.Logger LOG
    • Constructor Detail

      • RetryUtils

        public RetryUtils()
    • 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 executed
        maxRetries - the maximum number of retries
        retryDelay - 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 executed
        maxRetries - the maximum number of retries
        retryDelay - the delay between retries in milliseconds
        Returns:
        the task result