OPENJPA-1717: Disable FinderCache statistics by default.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@961017 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Richard G. Curtis 2010-07-06 21:31:12 +00:00
parent 17246f5ff2
commit 1738c1f33b
1 changed files with 12 additions and 1 deletions

View File

@ -58,11 +58,12 @@ public class FinderCacheImpl
private List<String> _exclusionPatterns; private List<String> _exclusionPatterns;
private QueryStatistics<ClassMapping> _stats; private QueryStatistics<ClassMapping> _stats;
private ReentrantLock _lock = new ReentrantLock(); private ReentrantLock _lock = new ReentrantLock();
private boolean _enableStats = false;
public FinderCacheImpl() { public FinderCacheImpl() {
_delegate = new HashMap<ClassMapping, FinderQuery<ClassMapping, SelectExecutor, Result>>(); _delegate = new HashMap<ClassMapping, FinderQuery<ClassMapping, SelectExecutor, Result>>();
_uncachables = new HashMap<String, String>(); _uncachables = new HashMap<String, String>();
_stats = new QueryStatistics.Default<ClassMapping>(); _stats = new QueryStatistics.None<ClassMapping>();
} }
/** /**
@ -364,6 +365,16 @@ public class FinderCacheImpl
_lock.unlock(); _lock.unlock();
} }
public void setEnableStats(boolean b) {
_enableStats = b;
if (_enableStats) {
_stats = new QueryStatistics.Default<ClassMapping>();
}
}
public boolean getEnableStats() {
return _enableStats;
}
// ---------------------------------------------------- // ----------------------------------------------------
// Configuration contract // Configuration contract
// ---------------------------------------------------- // ----------------------------------------------------