jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1445134 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IOCounters.java
Date Tue, 12 Feb 2013 12:28:09 GMT
Author: mreutegg
Date: Tue Feb 12 12:28:09 2013
New Revision: 1445134

URL: http://svn.apache.org/r1445134
Log:
JCR-3519: Disable IOCounters based on log level 

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IOCounters.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IOCounters.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IOCounters.java?rev=1445134&r1=1445133&r2=1445134&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IOCounters.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IOCounters.java
Tue Feb 12 12:28:09 2013
@@ -19,12 +19,17 @@ package org.apache.jackrabbit.core.query
 import java.util.Map;
 import java.util.WeakHashMap;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * <code>IOCounters</code> provides a basic mechanism to track I/O during query
  * execution.
  */
 public class IOCounters {
 
+    private static final Logger log = LoggerFactory.getLogger(IOCounters.class);
+
     private static final Map<Thread, Long> counts =
         new WeakHashMap<Thread, Long>();
 
@@ -39,7 +44,11 @@ public class IOCounters {
     /**
      * Increments the read count caused by the current thread.
      */
-    public static synchronized void incrRead() {
-        counts.put(Thread.currentThread(), getReads() + 1);
+    public static void incrRead() {
+        if (log.isDebugEnabled()) {
+            synchronized (IOCounters.class) {
+                counts.put(Thread.currentThread(), getReads() + 1);
+            }
+        }
     }
 }



Mime
View raw message