rmetzger commented on a change in pull request #14499:
URL: https://github.com/apache/flink/pull/14499#discussion_r558359969
##########
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:
Mh, that you are asking these questions makes me doubt whether this
change is necessary.
Let me change my suggestion to
```java
builder.list(modeDescriptions.toArray(new
TextElement[modeDescriptions.size()]));
builder.linebreak();
builder.text(
"Note that this configuration option can interfere with
%s: In intercepted user-code, a call to System.exit() will not cause the JVM to
halt, when %s is configured.",
code(HALT_ON_FATAL_ERROR.key()), code(THROW.name()));
```
Is it clearer now?
I'm also happy to not apply this suggestion. I believe we are optimizing the
last 1% out of two rarely used expert features.
----------------------------------------------------------------
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]