Class AbstractQueryCacheInstrument

  • All Implemented Interfaces:
    QueryCacheInstrument, org.apache.openjpa.lib.instrumentation.Instrument
    Direct Known Subclasses:
    QueryCacheJMXInstrument

    public abstract class AbstractQueryCacheInstrument
    extends org.apache.openjpa.lib.instrumentation.AbstractInstrument
    implements QueryCacheInstrument
    Provides a basic instrument implementation wrapper for the query cache. This class can be extended to create a provider specific instrument for the query cache.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long NO_STATS
      Value indicating that cache statistics are not available.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long count()
      Returns the number of total entries in the cache.
      java.lang.String getConfigId()  
      java.lang.String getContextRef()  
      long getEvictionCount()
      Returns number of total evictions since last reset
      long getExecutionCount()
      Returns number of total execution requests since last reset
      long getExecutionCount​(java.lang.String queryKey)
      Returns number of total execution requests since last reset for the specified string-ified query key.
      long getHitCount()
      Returns number of total read requests that have been found in cache since last reset.
      long getHitCount​(java.lang.String queryKey)
      Returns number of total read requests that have been found in cache since last reset for the specified string-ified query key.
      org.apache.openjpa.lib.instrumentation.InstrumentationLevel getLevel()  
      long getTotalEvictionCount()
      Returns number of total eviction requests since start.
      long getTotalExecutionCount()
      Returns number of total exec requests since start.
      long getTotalExecutionCount​(java.lang.String queryKey)
      Returns number of total exec requests since start for the specified string-ified query key.
      long getTotalHitCount()
      Returns number of total read requests that has been found since start.
      long getTotalHitCount​(java.lang.String queryKey)
      Returns number of total read requests that has been found since start for the specified string-ified query key.
      java.util.Set<java.lang.String> queryKeys()
      Returns all query keys currently tracked in the cache.
      void reset()
      Resets cache statistics
      void setConfigId​(java.lang.String cid)  
      void setContextRef​(java.lang.String cref)  
      void setPreparedQueryCache​(QueryCache qc)  
      void setQueryCache​(QueryCache qc)  
      java.util.Date sinceDate()
      Returns date since cache statistics collection were last reset.
      java.util.Date startDate()
      Returns date cache statistics collection started.
      • Methods inherited from class org.apache.openjpa.lib.instrumentation.AbstractInstrument

        getContext, getName, getOptions, getProvider, initialize, isStarted, restart, setContext, setOptions, setProvider, setStarted
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.openjpa.lib.instrumentation.Instrument

        start, stop
    • Field Detail

      • NO_STATS

        public static final long NO_STATS
        Value indicating that cache statistics are not available.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractQueryCacheInstrument

        public AbstractQueryCacheInstrument()
    • Method Detail

      • setQueryCache

        public void setQueryCache​(QueryCache qc)
      • setConfigId

        public void setConfigId​(java.lang.String cid)
      • setContextRef

        public void setContextRef​(java.lang.String cref)
      • getConfigId

        public java.lang.String getConfigId()
      • getContextRef

        public java.lang.String getContextRef()
      • setPreparedQueryCache

        public void setPreparedQueryCache​(QueryCache qc)
      • getExecutionCount

        public long getExecutionCount​(java.lang.String queryKey)
        Description copied from interface: QueryCacheInstrument
        Returns number of total execution requests since last reset for the specified string-ified query key.
        Specified by:
        getExecutionCount in interface QueryCacheInstrument
      • getTotalExecutionCount

        public long getTotalExecutionCount​(java.lang.String queryKey)
        Description copied from interface: QueryCacheInstrument
        Returns number of total exec requests since start for the specified string-ified query key.
        Specified by:
        getTotalExecutionCount in interface QueryCacheInstrument
      • getHitCount

        public long getHitCount​(java.lang.String queryKey)
        Description copied from interface: QueryCacheInstrument
        Returns number of total read requests that have been found in cache since last reset for the specified string-ified query key.
        Specified by:
        getHitCount in interface QueryCacheInstrument
      • getTotalHitCount

        public long getTotalHitCount​(java.lang.String queryKey)
        Description copied from interface: QueryCacheInstrument
        Returns number of total read requests that has been found since start for the specified string-ified query key.
        Specified by:
        getTotalHitCount in interface QueryCacheInstrument
      • queryKeys

        public java.util.Set<java.lang.String> queryKeys()
        Returns all query keys currently tracked in the cache.
        Specified by:
        queryKeys in interface QueryCacheInstrument
      • getLevel

        public org.apache.openjpa.lib.instrumentation.InstrumentationLevel getLevel()
        Specified by:
        getLevel in interface org.apache.openjpa.lib.instrumentation.Instrument
        Overrides:
        getLevel in class org.apache.openjpa.lib.instrumentation.AbstractInstrument