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



##########
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:
       >In your suggested documentation, I think HALT_ON_FATAL_ERROR should be 
INTERCEPT_USER_SYSTEM_EXIT.
   
   This part is obviously due to my misread of your comment. The new 
explanation seems clearer.
   
   >I'm also happy to not apply this suggestion. I believe we are optimizing 
the last 1% out of two rarely used expert features.
   
   Agreed but maybe adding this explanation may help. Added.




----------------------------------------------------------------
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