Java Code Examples for org.apache.flink.api.common.restartstrategy.RestartStrategies#FallbackRestartStrategyConfiguration
The following examples show how to use
org.apache.flink.api.common.restartstrategy.RestartStrategies#FallbackRestartStrategyConfiguration .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExecutionConfig.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Returns the restart strategy which has been set for the current job. * * @return The specified restart configuration */ @PublicEvolving @SuppressWarnings("deprecation") public RestartStrategies.RestartStrategyConfiguration getRestartStrategy() { if (restartStrategyConfiguration instanceof RestartStrategies.FallbackRestartStrategyConfiguration) { // support the old API calls by creating a restart strategy from them if (getNumberOfExecutionRetries() > 0 && getExecutionRetryDelay() >= 0) { return RestartStrategies.fixedDelayRestart(getNumberOfExecutionRetries(), getExecutionRetryDelay()); } else if (getNumberOfExecutionRetries() == 0) { return RestartStrategies.noRestart(); } else { return restartStrategyConfiguration; } } else { return restartStrategyConfiguration; } }
Example 2
Source File: RestartStrategyFactory.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Creates a {@link RestartStrategy} instance from the given {@link org.apache.flink.api.common.restartstrategy.RestartStrategies.RestartStrategyConfiguration}. * * @param restartStrategyConfiguration Restart strategy configuration which specifies which * restart strategy to instantiate * @return RestartStrategy instance */ public static RestartStrategy createRestartStrategy(RestartStrategies.RestartStrategyConfiguration restartStrategyConfiguration) { if (restartStrategyConfiguration instanceof RestartStrategies.NoRestartStrategyConfiguration) { return new NoRestartStrategy(); } else if (restartStrategyConfiguration instanceof RestartStrategies.FixedDelayRestartStrategyConfiguration) { RestartStrategies.FixedDelayRestartStrategyConfiguration fixedDelayConfig = (RestartStrategies.FixedDelayRestartStrategyConfiguration) restartStrategyConfiguration; return new FixedDelayRestartStrategy( fixedDelayConfig.getRestartAttempts(), fixedDelayConfig.getDelayBetweenAttemptsInterval().toMilliseconds()); } else if (restartStrategyConfiguration instanceof RestartStrategies.FailureRateRestartStrategyConfiguration) { RestartStrategies.FailureRateRestartStrategyConfiguration config = (RestartStrategies.FailureRateRestartStrategyConfiguration) restartStrategyConfiguration; return new FailureRateRestartStrategy( config.getMaxFailureRate(), config.getFailureInterval(), config.getDelayBetweenAttemptsInterval() ); } else if (restartStrategyConfiguration instanceof RestartStrategies.FallbackRestartStrategyConfiguration) { return null; } else { throw new IllegalArgumentException("Unknown restart strategy configuration " + restartStrategyConfiguration + "."); } }
Example 3
Source File: ExecutionConfig.java From flink with Apache License 2.0 | 6 votes |
/** * Returns the restart strategy which has been set for the current job. * * @return The specified restart configuration */ @PublicEvolving @SuppressWarnings("deprecation") public RestartStrategies.RestartStrategyConfiguration getRestartStrategy() { if (restartStrategyConfiguration instanceof RestartStrategies.FallbackRestartStrategyConfiguration) { // support the old API calls by creating a restart strategy from them if (getNumberOfExecutionRetries() > 0 && getExecutionRetryDelay() >= 0) { return RestartStrategies.fixedDelayRestart(getNumberOfExecutionRetries(), getExecutionRetryDelay()); } else if (getNumberOfExecutionRetries() == 0) { return RestartStrategies.noRestart(); } else { return restartStrategyConfiguration; } } else { return restartStrategyConfiguration; } }
Example 4
Source File: RestartStrategyFactory.java From flink with Apache License 2.0 | 6 votes |
/** * Creates a {@link RestartStrategy} instance from the given {@link org.apache.flink.api.common.restartstrategy.RestartStrategies.RestartStrategyConfiguration}. * * @param restartStrategyConfiguration Restart strategy configuration which specifies which * restart strategy to instantiate * @return RestartStrategy instance */ public static RestartStrategy createRestartStrategy(RestartStrategies.RestartStrategyConfiguration restartStrategyConfiguration) { if (restartStrategyConfiguration instanceof RestartStrategies.NoRestartStrategyConfiguration) { return new NoRestartStrategy(); } else if (restartStrategyConfiguration instanceof RestartStrategies.FixedDelayRestartStrategyConfiguration) { RestartStrategies.FixedDelayRestartStrategyConfiguration fixedDelayConfig = (RestartStrategies.FixedDelayRestartStrategyConfiguration) restartStrategyConfiguration; return new FixedDelayRestartStrategy( fixedDelayConfig.getRestartAttempts(), fixedDelayConfig.getDelayBetweenAttemptsInterval().toMilliseconds()); } else if (restartStrategyConfiguration instanceof RestartStrategies.FailureRateRestartStrategyConfiguration) { RestartStrategies.FailureRateRestartStrategyConfiguration config = (RestartStrategies.FailureRateRestartStrategyConfiguration) restartStrategyConfiguration; return new FailureRateRestartStrategy( config.getMaxFailureRate(), config.getFailureInterval(), config.getDelayBetweenAttemptsInterval() ); } else if (restartStrategyConfiguration instanceof RestartStrategies.FallbackRestartStrategyConfiguration) { return null; } else { throw new IllegalArgumentException("Unknown restart strategy configuration " + restartStrategyConfiguration + "."); } }
Example 5
Source File: ExecutionConfig.java From flink with Apache License 2.0 | 6 votes |
/** * Returns the restart strategy which has been set for the current job. * * @return The specified restart configuration */ @PublicEvolving @SuppressWarnings("deprecation") public RestartStrategies.RestartStrategyConfiguration getRestartStrategy() { if (restartStrategyConfiguration instanceof RestartStrategies.FallbackRestartStrategyConfiguration) { // support the old API calls by creating a restart strategy from them if (getNumberOfExecutionRetries() > 0 && getExecutionRetryDelay() >= 0) { return RestartStrategies.fixedDelayRestart(getNumberOfExecutionRetries(), getExecutionRetryDelay()); } else if (getNumberOfExecutionRetries() == 0) { return RestartStrategies.noRestart(); } else { return restartStrategyConfiguration; } } else { return restartStrategyConfiguration; } }
Example 6
Source File: RestartStrategyFactory.java From flink with Apache License 2.0 | 6 votes |
/** * Creates a {@link RestartStrategy} instance from the given {@link org.apache.flink.api.common.restartstrategy.RestartStrategies.RestartStrategyConfiguration}. * * @param restartStrategyConfiguration Restart strategy configuration which specifies which * restart strategy to instantiate * @return RestartStrategy instance */ public static RestartStrategy createRestartStrategy(RestartStrategies.RestartStrategyConfiguration restartStrategyConfiguration) { if (restartStrategyConfiguration instanceof RestartStrategies.NoRestartStrategyConfiguration) { return new NoRestartStrategy(); } else if (restartStrategyConfiguration instanceof RestartStrategies.FixedDelayRestartStrategyConfiguration) { RestartStrategies.FixedDelayRestartStrategyConfiguration fixedDelayConfig = (RestartStrategies.FixedDelayRestartStrategyConfiguration) restartStrategyConfiguration; return new FixedDelayRestartStrategy( fixedDelayConfig.getRestartAttempts(), fixedDelayConfig.getDelayBetweenAttemptsInterval().toMilliseconds()); } else if (restartStrategyConfiguration instanceof RestartStrategies.FailureRateRestartStrategyConfiguration) { RestartStrategies.FailureRateRestartStrategyConfiguration config = (RestartStrategies.FailureRateRestartStrategyConfiguration) restartStrategyConfiguration; return new FailureRateRestartStrategy( config.getMaxFailureRate(), config.getFailureInterval(), config.getDelayBetweenAttemptsInterval() ); } else if (restartStrategyConfiguration instanceof RestartStrategies.FallbackRestartStrategyConfiguration) { return null; } else { throw new IllegalArgumentException("Unknown restart strategy configuration " + restartStrategyConfiguration + "."); } }