Package com.atlassian.jira.cache
Class GoogleCacheInstruments
java.lang.Object
com.atlassian.jira.cache.GoogleCacheInstruments
Registers cache metrics in
Instrumentation. This is usually called from within a component's "start" callback
(e.g. JIRA's Startable.start() or Spring's InitializingBean.afterPropertiesSet()). Example:
new GoogleCacheInstruments("cacheName").addCache(this.cacheOfThings).install();
Remember to call GoogleCacheInstruments.uninstall() in the destruction callbacks, or you will cause a memory
leak.
This class is thread-safe.
- Since:
- v5.1
-
Constructor Summary
ConstructorsConstructorDescriptionGoogleCacheInstruments(String name) Creates a new GoogleCacheInstruments with the given name. -
Method Summary
Modifier and TypeMethodDescriptionaddCache(com.google.common.cache.Cache cache) Addscacheto the list of caches to expose in JIRA instrumentation.getName()install()Installs one instrument for each of the following statistics for all caches that are monitored by this GoogleCacheInstruments instance: size hitCount missCount loadSuccessCount loadExceptionCount totalLoadTime evictionCountremoveCache(com.google.common.cache.Cache cache) Removescachefrom the list of caches to expose in JIRA instrumentation.Currently does nothing because JIRA does not support uninstalling instruments.
-
Constructor Details
-
GoogleCacheInstruments
Creates a new GoogleCacheInstruments with the given name.- Parameters:
name- the name under which the counters will appear in JIRA instrumentation
-
-
Method Details
-
getName
- Returns:
- this GoogleCacheInstruments's name
-
addCache
Addscacheto the list of caches to expose in JIRA instrumentation.- Parameters:
cache- a Cache- Returns:
- this
-
removeCache
Removescachefrom the list of caches to expose in JIRA instrumentation.- Parameters:
cache- a Cache- Returns:
- this
-
install
Installs one instrument for each of the following statistics for all caches that are monitored by this GoogleCacheInstruments instance:- size
- hitCount
- missCount
- loadSuccessCount
- loadExceptionCount
- totalLoadTime
- evictionCount
- Returns:
- this
-
uninstall
Currently does nothing because JIRA does not support uninstalling instruments.- Returns:
- this
-