qinf commented on code in PR #23942:
URL: https://github.com/apache/flink/pull/23942#discussion_r1462656608
##########
flink-core/src/main/java/org/apache/flink/configuration/RestartStrategyOptions.java:
##########
@@ -55,6 +64,54 @@ public class RestartStrategyOptions {
@Internal public static final String RESTART_STRATEGY_CONFIG_PREFIX =
"restart-strategy";
+ /** The restart strategy type. */
+ @Internal
+ public enum RestartStrategyType {
+ NO_RESTART_STRATEGY("disable", Sets.newHashSet("none", "off")),
+ FIXED_DELAY("fixed-delay", Sets.newHashSet("fixeddelay")),
+ FAILURE_RATE("failure-rate", Sets.newHashSet("failurerate")),
+ EXPONENTIAL_DELAY("exponential-delay",
Sets.newHashSet("exponentialdelay"));
+
+ private final String mainValue;
+ private final Set<String> allAvailableValues;
+
+ RestartStrategyType(String mainValue, Set<String>
otherAvailableValues) {
+ this.mainValue = mainValue;
+ this.allAvailableValues = Sets.newHashSet(mainValue);
+ allAvailableValues.addAll(otherAvailableValues);
+ }
+
+ /** Return the corresponding RestartStrategyType based on the
displayed value. */
+ public static RestartStrategyType getTypeFromValue(String value) {
+ for (RestartStrategyType restartStrategyType :
RestartStrategyType.values()) {
Review Comment:
@1996fanrui How about making it even simpler by using of() instead of
getTypeFromValue()?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]