Class AbstractDataCacheInstrument
java.lang.Object
org.apache.openjpa.lib.instrumentation.AbstractInstrument
org.apache.openjpa.instrumentation.AbstractDataCacheInstrument
- All Implemented Interfaces:
DataCacheInstrument,Instrument
- Direct Known Subclasses:
DataCacheJMXInstrument
public abstract class AbstractDataCacheInstrument
extends AbstractInstrument
implements DataCacheInstrument
Provides a basic instrument implementation wrapper for the data cache. This class can be extended to create a
provider specific instrument for the data cache.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longValue indicating that cache statistics are not available. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is used to enable/disable caching for the specified className.voidclear()Clears all data from the DataCache.voidcollectStatistics(boolean enable) Returns the name of the cacheReturns the CacheStatistics for the cache.longReturns the hit count since cache statistics were last resetlongGets number of total read requests that has been found in cache for the given class since last reset.getLevel()Gets the instrumentation level of this instrument.longReturns the read count since cache statistics were last resetlongGets number of total read requests for the given class since last reset.Returns true if cache statistics are currently being calculated.longReturns the total hits since start.longGets number of total read requests that has been found in cache for the given class since start.longReturns the total reads since start.longGets number of total read requests for the given class since start.longReturns the total writes since start.longGets number of total write requests for the given class since start.longReturns the write count since cache statistics were last resetlongGets number of total write requests for the given class since last reset.Returns the names of classes that are known to the cache and whether or not they are currently being cached.voidreset()Resets cache statisticsvoidsetConfigId(String cid) voidsetContextRef(String cref) voidvoidReturns date since cache statistics collection were last reset.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, setStartedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.openjpa.lib.instrumentation.Instrument
start, stop
-
Field Details
-
NO_STATS
public static final long NO_STATSValue indicating that cache statistics are not available.- See Also:
-
-
Constructor Details
-
AbstractDataCacheInstrument
public AbstractDataCacheInstrument()
-
-
Method Details
-
setDataCache
-
setDataCacheManager
-
setConfigId
-
setContextRef
-
getHitCount
public long getHitCount()Description copied from interface:DataCacheInstrumentReturns the hit count since cache statistics were last reset- Specified by:
getHitCountin interfaceDataCacheInstrument
-
getReadCount
public long getReadCount()Description copied from interface:DataCacheInstrumentReturns the read count since cache statistics were last reset- Specified by:
getReadCountin interfaceDataCacheInstrument
-
getTotalHitCount
public long getTotalHitCount()Description copied from interface:DataCacheInstrumentReturns the total hits since start.- Specified by:
getTotalHitCountin interfaceDataCacheInstrument
-
getTotalReadCount
public long getTotalReadCount()Description copied from interface:DataCacheInstrumentReturns the total reads since start.- Specified by:
getTotalReadCountin interfaceDataCacheInstrument
-
getTotalWriteCount
public long getTotalWriteCount()Description copied from interface:DataCacheInstrumentReturns the total writes since start.- Specified by:
getTotalWriteCountin interfaceDataCacheInstrument
-
getWriteCount
public long getWriteCount()Description copied from interface:DataCacheInstrumentReturns the write count since cache statistics were last reset- Specified by:
getWriteCountin interfaceDataCacheInstrument
-
reset
public void reset()Description copied from interface:DataCacheInstrumentResets cache statistics- Specified by:
resetin interfaceDataCacheInstrument
-
sinceDate
Description copied from interface:DataCacheInstrumentReturns date since cache statistics collection were last reset.- Specified by:
sinceDatein interfaceDataCacheInstrument
-
startDate
Description copied from interface:DataCacheInstrumentReturns date cache statistics collection started.- Specified by:
startDatein interfaceDataCacheInstrument
-
getConfigId
-
getContextRef
-
getCacheName
Description copied from interface:DataCacheInstrumentReturns the name of the cache- Specified by:
getCacheNamein interfaceDataCacheInstrument
-
getWriteCount
Description copied from interface:DataCacheInstrumentGets number of total write requests for the given class since last reset.- Specified by:
getWriteCountin interfaceDataCacheInstrument
-
getTotalWriteCount
Description copied from interface:DataCacheInstrumentGets number of total write requests for the given class since start.- Specified by:
getTotalWriteCountin interfaceDataCacheInstrument
-
getTotalReadCount
Description copied from interface:DataCacheInstrumentGets number of total read requests for the given class since start.- Specified by:
getTotalReadCountin interfaceDataCacheInstrument
-
getTotalHitCount
Description copied from interface:DataCacheInstrumentGets number of total read requests that has been found in cache for the given class since start.- Specified by:
getTotalHitCountin interfaceDataCacheInstrument
-
getReadCount
Description copied from interface:DataCacheInstrumentGets number of total read requests for the given class since last reset.- Specified by:
getReadCountin interfaceDataCacheInstrument
-
getHitCount
Description copied from interface:DataCacheInstrumentGets number of total read requests that has been found in cache for the given class since last reset.- Specified by:
getHitCountin interfaceDataCacheInstrument
-
getLevel
Description copied from interface:InstrumentGets the instrumentation level of this instrument. The instrumentation level determines if and when the instrument will automatically start and stop.- Specified by:
getLevelin interfaceInstrument- Overrides:
getLevelin classAbstractInstrument- Returns:
- the instrumentation level of the instrument
-
cache
Description copied from interface:DataCacheInstrumentThis method is used to enable/disable caching for the specified className.- Specified by:
cachein interfaceDataCacheInstrument
-
listKnownTypes
Description copied from interface:DataCacheInstrumentReturns the names of classes that are known to the cache and whether or not they are currently being cached.- Specified by:
listKnownTypesin interfaceDataCacheInstrument
-
collectStatistics
public void collectStatistics(boolean enable) - Specified by:
collectStatisticsin interfaceDataCacheInstrument- Parameters:
enable- - If true, the cache will start collecting statistics. Else cache statistics will not be collected.
-
getStatisticsEnabled
Description copied from interface:DataCacheInstrumentReturns true if cache statistics are currently being calculated. False otherwise.- Specified by:
getStatisticsEnabledin interfaceDataCacheInstrument
-
getCacheStatistics
Description copied from interface:DataCacheInstrumentReturns the CacheStatistics for the cache. The format for this map is: Type(String) => Enabled(Boolean),Read(Long),Hit(Long),Write(Long)- Specified by:
getCacheStatisticsin interfaceDataCacheInstrument
-
clear
public void clear()Description copied from interface:DataCacheInstrumentClears all data from the DataCache.- Specified by:
clearin interfaceDataCacheInstrument
-