horizonzy commented on code in PR #3794:
URL: https://github.com/apache/bookkeeper/pull/3794#discussion_r1113977780
##########
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:
> We'd better print out the levelStr in the log
Make sense
> Maybe we need to change the log level to ERROR instead of WARN?
I think warn is enough. It can work well. If we throw an exception, we can
use ERROR log.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]