jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1479815 - in /jackrabbit/branches/2.6: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IOCounters.java
Date Tue, 07 May 2013 08:50:50 GMT
Author: alexparvulescu
Date: Tue May  7 08:50:50 2013
New Revision: 1479815

URL: http://svn.apache.org/r1479815
Log:
JCR-3519 Disable IOCounters based on log level (backport to 2.6)

Modified:
    jackrabbit/branches/2.6/   (props changed)
    jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IOCounters.java

Propchange: jackrabbit/branches/2.6/
------------------------------------------------------------------------------
  Merged /jackrabbit/trunk:r1445134

Modified: jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IOCounters.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IOCounters.java?rev=1479815&r1=1479814&r2=1479815&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IOCounters.java
(original)
+++ jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IOCounters.java
Tue May  7 08:50:50 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