mirror of https://github.com/apache/openjpa.git
OPENJPA-1566: Allow access to keys of the statistics.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@922311 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f04031edc1
commit
732ff354b3
|
@ -23,6 +23,7 @@ import java.io.Serializable;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Records query execution statistics.
|
||||
|
@ -39,6 +40,11 @@ import java.util.Map;
|
|||
*/
|
||||
public interface QueryStatistics<T> extends Serializable {
|
||||
|
||||
/**
|
||||
* Gets all the identifier keys for the cached queries.
|
||||
*/
|
||||
public Set<T> keys();
|
||||
|
||||
/**
|
||||
* Record that the given query has been executed.
|
||||
*/
|
||||
|
@ -127,6 +133,10 @@ public interface QueryStatistics<T> extends Serializable {
|
|||
private Date start = new Date();
|
||||
private Date since = start;
|
||||
|
||||
public Set<T> keys() {
|
||||
return stats.keySet();
|
||||
}
|
||||
|
||||
public long getExecutionCount() {
|
||||
return stat[READ];
|
||||
}
|
||||
|
@ -205,6 +215,8 @@ public interface QueryStatistics<T> extends Serializable {
|
|||
}
|
||||
|
||||
public void recordExecution(T query) {
|
||||
if (query == null)
|
||||
return;
|
||||
boolean cached = (astats.containsKey(query));
|
||||
addSample(query, READ);
|
||||
if (cached)
|
||||
|
|
Loading…
Reference in New Issue