hwanju commented on a change in pull request #14499:
URL: https://github.com/apache/flink/pull/14499#discussion_r558339332



##########
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:
       Two questions:
   1. Above header explanation, `Flag to check user code exiting system by 
terminating JVM` is added already to indicate it's for user code. Do you think 
one more emphasis at the end like you described?
   2. In your suggested documentation, I think `HALT_ON_FATAL_ERROR` should be 
`INTERCEPT_USER_SYSTEM_EXIT`.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to