Class RestartStrategies


  • @Deprecated
    @PublicEvolving
    public class RestartStrategies
    extends Object
    Deprecated.
    The RestartStrategies class is marked as deprecated because starting from Flink 1.19, all complex Java objects related to configuration should be replaced by ConfigOption. In a future major version of Flink, this class will be removed entirely. It is recommended to switch to using the ConfigOptions provided by RestartStrategyOptions for configuring restart strategies like the following code snippet:
    
     Configuration config = new Configuration();
     config.set(RestartStrategyOptions.RESTART_STRATEGY, "fixed-delay");
     config.set(RestartStrategyOptions.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS, 3);
     config.set(RestartStrategyOptions.RESTART_STRATEGY_FIXED_DELAY_DELAY, Duration.ofMinutes(1));
     StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(config);
     
    For more details on using ConfigOption for restart strategies, please refer to the Flink documentation: restart-strategies
    This class defines methods to generate RestartStrategyConfigurations. These configurations are used to create RestartStrategies at runtime.

    The RestartStrategyConfigurations are used to decouple the core module from the runtime module.

    • Constructor Detail

      • RestartStrategies

        public RestartStrategies()
        Deprecated.
    • Method Detail

      • fixedDelayRestart

        public static RestartStrategies.RestartStrategyConfiguration fixedDelayRestart​(int restartAttempts,
                                                                                       long delayBetweenAttempts)
        Deprecated.
        Generates a FixedDelayRestartStrategyConfiguration.
        Parameters:
        restartAttempts - Number of restart attempts for the FixedDelayRestartStrategy
        delayBetweenAttempts - Delay in-between restart attempts for the FixedDelayRestartStrategy
        Returns:
        FixedDelayRestartStrategy
      • fixedDelayRestart

        @Deprecated
        public static RestartStrategies.RestartStrategyConfiguration fixedDelayRestart​(int restartAttempts,
                                                                                       Time delayInterval)
        Generates a FixedDelayRestartStrategyConfiguration.
        Parameters:
        restartAttempts - Number of restart attempts for the FixedDelayRestartStrategy
        delayInterval - Delay in-between restart attempts for the FixedDelayRestartStrategy
        Returns:
        FixedDelayRestartStrategy
      • fixedDelayRestart

        public static RestartStrategies.RestartStrategyConfiguration fixedDelayRestart​(int restartAttempts,
                                                                                       java.time.Duration delayInterval)
        Deprecated.
        Generates a FixedDelayRestartStrategyConfiguration.
        Parameters:
        restartAttempts - Number of restart attempts for the FixedDelayRestartStrategy
        delayInterval - Delay in-between restart attempts for the FixedDelayRestartStrategy
        Returns:
        FixedDelayRestartStrategy
      • failureRateRestart

        public static RestartStrategies.FailureRateRestartStrategyConfiguration failureRateRestart​(int failureRate,
                                                                                                   java.time.Duration failureInterval,
                                                                                                   java.time.Duration delayInterval)
        Deprecated.
        Generates a FailureRateRestartStrategyConfiguration.
        Parameters:
        failureRate - Maximum number of restarts in given interval failureInterval before failing a job
        failureInterval - Time interval for failures
        delayInterval - Delay in-between restart attempts
      • exponentialDelayRestart

        public static RestartStrategies.ExponentialDelayRestartStrategyConfiguration exponentialDelayRestart​(java.time.Duration initialBackoff,
                                                                                                             java.time.Duration maxBackoff,
                                                                                                             double backoffMultiplier,
                                                                                                             java.time.Duration resetBackoffThreshold,
                                                                                                             double jitterFactor)
        Deprecated.
        Generates a ExponentialDelayRestartStrategyConfiguration.
        Parameters:
        initialBackoff - Starting duration between restarts
        maxBackoff - The highest possible duration between restarts
        backoffMultiplier - Delay multiplier how many times is the delay longer than before
        resetBackoffThreshold - How long the job must run smoothly to reset the time interval
        jitterFactor - How much the delay may differ (in percentage)