rmetzger commented on a change in pull request #14499:
URL: https://github.com/apache/flink/pull/14499#discussion_r558333937
##########
File path:
flink-core/src/main/java/org/apache/flink/configuration/ClusterOptions.java
##########
@@ -115,4 +127,35 @@ public static boolean
isDeclarativeResourceManagementEnabled(Configuration confi
return configuration.get(ENABLE_DECLARATIVE_RESOURCE_MANAGEMENT)
&&
!System.getProperties().containsKey("flink.tests.disable-declarative");
}
+
+ /** The mode of how to handle user code attempting to exit JVM. */
+ public enum UserSystemExitMode {
+ DISABLED("Flink is not monitoring or intercepting calls to
System.exit()"),
+ LOG("Log exit attempt with stack trace but still allowing exit to be
performed"),
+ THROW("Throw exception when exit is attempted disallowing JVM
termination");
+
+ private final String description;
+
+ UserSystemExitMode(String description) {
+ this.description = description;
+ }
+
+ public static Description getConfigDescription() {
+ Description.DescriptionBuilder builder = Description.builder();
+ List<TextElement> modeDescriptions =
+ new ArrayList<>(UserSystemExitMode.values().length);
+ builder.text(
+ "Flag to check user code exiting system by terminating JVM
(e.g., System.exit())");
+ for (UserSystemExitMode mode : UserSystemExitMode.values()) {
+ modeDescriptions.add(
+ text(String.format("%s - %s", mode.name(),
mode.getDescription())));
+ }
+ builder.list(modeDescriptions.toArray(new
TextElement[modeDescriptions.size()]));
Review comment:
```suggestion
builder.list(modeDescriptions.toArray(new
TextElement[modeDescriptions.size()]));
builder.text(
"This configuration value might change the behavior of
%s, when configured to %s and System.exit() gets called in user code.",
code(HALT_ON_FATAL_ERROR.key()), code(THROW.name()));
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]