You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by "hangc0276 (via GitHub)" <gi...@apache.org> on 2023/03/13 23:36:07 UTC

[GitHub] [bookkeeper] hangc0276 commented on a diff in pull request #3794: Pick the higher leak detection level between netty and bookkeeper.

hangc0276 commented on code in PR #3794:
URL: https://github.com/apache/bookkeeper/pull/3794#discussion_r1134720134


##########
bookkeeper-common-allocator/src/main/java/org/apache/bookkeeper/common/allocator/LeakDetectionPolicy.java:
##########
@@ -43,5 +43,15 @@ public enum LeakDetectionPolicy {
      * stack traces of places where the buffer was used. Introduce very
      * significant overhead.
      */
-    Paranoid,
+    Paranoid;
+
+    public static LeakDetectionPolicy parseLevel(String levelStr) {
+        String trimmedLevelStr = levelStr.trim();
+        for (LeakDetectionPolicy policy : values()) {
+            if (trimmedLevelStr.equalsIgnoreCase(policy.name())) {
+                return policy;
+            }
+        }
+        return LeakDetectionPolicy.Disabled;

Review Comment:
   Use: `log.warn("Parse leak detection policy level {} failed. Use the default level: {}", levelStr, LeakDetectionPolicy.Disabled.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.

To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org