com.atlassian.jira.cache
Class GoogleCacheInstruments

java.lang.Object
  extended by com.atlassian.jira.cache.GoogleCacheInstruments

@ThreadSafe
public class GoogleCacheInstruments
extends Object

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
GoogleCacheInstruments(String name)
          Creates a new GoogleCacheInstruments with the given name.
 
Method Summary
 GoogleCacheInstruments addCache(com.google.common.cache.Cache cache)
          Adds cache to the list of caches to expose in JIRA instrumentation.
 String getName()
           
 GoogleCacheInstruments 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
 GoogleCacheInstruments removeCache(com.google.common.cache.Cache cache)
          Removes cache from the list of caches to expose in JIRA instrumentation.
 GoogleCacheInstruments uninstall()
          Currently does nothing because JIRA does not support uninstalling instruments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GoogleCacheInstruments

public GoogleCacheInstruments(String name)
Creates a new GoogleCacheInstruments with the given name.

Parameters:
name - the name under which the counters will appear in JIRA instrumentation
Method Detail

getName

public String getName()
Returns:
this GoogleCacheInstruments's name

addCache

public GoogleCacheInstruments addCache(com.google.common.cache.Cache cache)
Adds cache to the list of caches to expose in JIRA instrumentation.

Parameters:
cache - a Cache
Returns:
this

removeCache

public GoogleCacheInstruments removeCache(com.google.common.cache.Cache cache)
Removes cache from the list of caches to expose in JIRA instrumentation.

Parameters:
cache - a Cache
Returns:
this

install

public GoogleCacheInstruments install()
Installs one instrument for each of the following statistics for all caches that are monitored by this GoogleCacheInstruments instance:
  1. size
  2. hitCount
  3. missCount
  4. loadSuccessCount
  5. loadExceptionCount
  6. totalLoadTime
  7. evictionCount

Returns:
this

uninstall

public GoogleCacheInstruments uninstall()
Currently does nothing because JIRA does not support uninstalling instruments.

Returns:
this


Copyright © 2002-2014 Atlassian. All Rights Reserved.