org.apache.openjpa.datacache
Class AbstractQueryCache.Default<T>

java.lang.Object
  extended by org.apache.openjpa.datacache.AbstractQueryCache.Default<T>
All Implemented Interfaces:
Serializable, QueryStatistics<T>
Enclosing class:
AbstractQueryCache

public static class AbstractQueryCache.Default<T>
extends Object
implements QueryStatistics<T>

A default implementation of query statistics for the Query result cache. Maintains statistics for only a fixed number of queries. Statistical counts are approximate and not exact (to keep thread synchorization overhead low).

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.openjpa.kernel.QueryStatistics
QueryStatistics.Default<T>, QueryStatistics.None<T>
 
Constructor Summary
AbstractQueryCache.Default()
           
 
Method Summary
 void clear()
          Clears all statistics accumulated since start.
 void dump(PrintStream out)
          Dumps on the given output stream.
 long getEvictionCount()
          Gets number of total query evictions since last reset.
 long getExecutionCount()
          Gets number of total query execution since last reset.
 long getExecutionCount(T query)
          Gets number of executions for the given query since last reset.
 long getHitCount()
          Gets number of total query execution that are cached since last reset.
 long getHitCount(T query)
          Gets number of executions for the given query that are cached since last reset.
 long getTotalEvictionCount()
          Gets number of total query evictions since start.
 long getTotalExecutionCount()
          Gets number of total query execution since start.
 long getTotalExecutionCount(T query)
          Gets number of executions for the given query since start.
 long getTotalHitCount()
          Gets number of total query execution that are cached since start.
 long getTotalHitCount(T query)
          Gets number of executions for the given query that are cached since start.
 Set<T> keys()
          Gets all the identifier keys for the cached queries.
(package private)  long pct(long per, long cent)
           
 void recordEviction(T query)
          Record that the given query has been evicted.
 void recordExecution(T query)
          Record that the given query has been executed.
 void recordHit(T query)
           
 void reset()
          Clears all statistics accumulated since last reset.
 Date since()
          Gets the time of last reset.
 Date start()
          Gets the time of start.
(package private)  String toString(long[] row)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractQueryCache.Default

public AbstractQueryCache.Default()
Method Detail

keys

public Set<T> keys()
Description copied from interface: QueryStatistics
Gets all the identifier keys for the cached queries.

Specified by:
keys in interface QueryStatistics<T>

getExecutionCount

public long getExecutionCount()
Description copied from interface: QueryStatistics
Gets number of total query execution since last reset.

Specified by:
getExecutionCount in interface QueryStatistics<T>

getTotalExecutionCount

public long getTotalExecutionCount()
Description copied from interface: QueryStatistics
Gets number of total query execution since start.

Specified by:
getTotalExecutionCount in interface QueryStatistics<T>

getExecutionCount

public long getExecutionCount(T query)
Description copied from interface: QueryStatistics
Gets number of executions for the given query since last reset.

Specified by:
getExecutionCount in interface QueryStatistics<T>

getTotalExecutionCount

public long getTotalExecutionCount(T query)
Description copied from interface: QueryStatistics
Gets number of executions for the given query since start.

Specified by:
getTotalExecutionCount in interface QueryStatistics<T>

getHitCount

public long getHitCount()
Description copied from interface: QueryStatistics
Gets number of total query execution that are cached since last reset.

Specified by:
getHitCount in interface QueryStatistics<T>

getTotalHitCount

public long getTotalHitCount()
Description copied from interface: QueryStatistics
Gets number of total query execution that are cached since start.

Specified by:
getTotalHitCount in interface QueryStatistics<T>

getHitCount

public long getHitCount(T query)
Description copied from interface: QueryStatistics
Gets number of executions for the given query that are cached since last reset.

Specified by:
getHitCount in interface QueryStatistics<T>

getTotalHitCount

public long getTotalHitCount(T query)
Description copied from interface: QueryStatistics
Gets number of executions for the given query that are cached since start.

Specified by:
getTotalHitCount in interface QueryStatistics<T>

getEvictionCount

public long getEvictionCount()
Description copied from interface: QueryStatistics
Gets number of total query evictions since last reset.

Specified by:
getEvictionCount in interface QueryStatistics<T>

getTotalEvictionCount

public long getTotalEvictionCount()
Description copied from interface: QueryStatistics
Gets number of total query evictions since start.

Specified by:
getTotalEvictionCount in interface QueryStatistics<T>

since

public Date since()
Description copied from interface: QueryStatistics
Gets the time of last reset.

Specified by:
since in interface QueryStatistics<T>

start

public Date start()
Description copied from interface: QueryStatistics
Gets the time of start.

Specified by:
start in interface QueryStatistics<T>

reset

public void reset()
Description copied from interface: QueryStatistics
Clears all statistics accumulated since last reset.

Specified by:
reset in interface QueryStatistics<T>

clear

public void clear()
Description copied from interface: QueryStatistics
Clears all statistics accumulated since start.

Specified by:
clear in interface QueryStatistics<T>

recordExecution

public void recordExecution(T query)
Description copied from interface: QueryStatistics
Record that the given query has been executed.

Specified by:
recordExecution in interface QueryStatistics<T>

recordHit

public void recordHit(T query)

recordEviction

public void recordEviction(T query)
Description copied from interface: QueryStatistics
Record that the given query has been evicted.

Specified by:
recordEviction in interface QueryStatistics<T>

dump

public void dump(PrintStream out)
Description copied from interface: QueryStatistics
Dumps on the given output stream.

Specified by:
dump in interface QueryStatistics<T>

pct

long pct(long per,
         long cent)

toString

String toString(long[] row)


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.