OPENJPA-703: Remove sync on stats

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@935035 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2010-04-16 18:32:32 +00:00
parent 191c7fd329
commit fb1808b2a3
1 changed files with 4 additions and 3 deletions

View File

@ -123,7 +123,8 @@ public interface QueryStatistics<T> extends Serializable {
* A default implementation.
*
* Maintains statistics for only a fixed number of queries.
*
* Statistical counts are approximate and not exact (to keep thread synchorization overhead low).
*
*/
public static class Default<T> implements QueryStatistics<T> {
private static final int FIXED_SIZE = 1000;
@ -222,7 +223,7 @@ public interface QueryStatistics<T> extends Serializable {
target.put(query, row);
}
public synchronized void recordExecution(T query) {
public void recordExecution(T query) {
if (query == null)
return;
boolean cached = astats.containsKey(query);
@ -267,4 +268,4 @@ public interface QueryStatistics<T> extends Serializable {
return row[READ] + ":" + row[HIT] + "(" + pct(row[HIT], row[READ]) + "%)";
}
}
}
}