reschke commented on code in PR #813:
URL: https://github.com/apache/jackrabbit-oak/pull/813#discussion_r1064515687


##########
oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java:
##########
@@ -78,6 +79,23 @@ public class SessionDelegate {
     static final Logger readOperationLogger = 
LoggerFactory.getLogger("org.apache.jackrabbit.oak.jcr.operations.reads");
     static final Logger writeOperationLogger = 
LoggerFactory.getLogger("org.apache.jackrabbit.oak.jcr.operations.writes");
 
+    // the bitmask used for trace level logging
+    // we use a bitmask instead of a counter to avoid the slow modulo 
operation:
+    // 
https://stackoverflow.com/questions/27977834/why-is-modulus-operator-slow
+    // so we use "if ((counter & LOG_TRACE_BIT_MASK) == 0) log(...)"
+    // instead of the slower "if ((counter % LOG_TRACE) == 0) log(...)"
+    // that means the values need to be some power of two, minus one
+    // log every 128th call by default
+    private static final long LOG_TRACE_BIT_MASK = Long.getLong(

Review Comment:
   please use 
https://www.javadoc.io/static/org.apache.jackrabbit/oak-commons/1.46.0/org/apache/jackrabbit/oak/commons/properties/SystemPropertySupplier.html



-- 
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: dev-unsubscr...@jackrabbit.apache.org

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

Reply via email to