openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r961017 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderCacheImpl.java
Date Tue, 06 Jul 2010 21:31:13 GMT
Author: curtisr7
Date: Tue Jul  6 21:31:12 2010
New Revision: 961017

URL: http://svn.apache.org/viewvc?rev=961017&view=rev
Log:
OPENJPA-1717: Disable FinderCache statistics by default.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderCacheImpl.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderCacheImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderCacheImpl.java?rev=961017&r1=961016&r2=961017&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderCacheImpl.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/FinderCacheImpl.java
Tue Jul  6 21:31:12 2010
@@ -58,11 +58,12 @@ public class FinderCacheImpl 
     private List<String> _exclusionPatterns;
     private QueryStatistics<ClassMapping> _stats;
     private ReentrantLock _lock = new ReentrantLock();
+    private boolean _enableStats = false;
     
     public FinderCacheImpl() {
         _delegate = new HashMap<ClassMapping, FinderQuery<ClassMapping, SelectExecutor,
Result>>();
         _uncachables = new HashMap<String, String>();
-        _stats = new QueryStatistics.Default<ClassMapping>();
+        _stats = new QueryStatistics.None<ClassMapping>();
     }
     
     /**
@@ -364,6 +365,16 @@ public class FinderCacheImpl 
             _lock.unlock();
     }
      
+    public void setEnableStats(boolean b) { 
+        _enableStats = b;
+        if (_enableStats) {
+            _stats = new QueryStatistics.Default<ClassMapping>();
+        }
+    }
+
+    public boolean getEnableStats() {
+        return _enableStats;
+    }
     // ----------------------------------------------------
     //  Configuration contract
     // ----------------------------------------------------



Mime
View raw message