com.atlassian.jira.config.properties
Class JiraSystemPropertiesCache

java.lang.Object
  extended by com.atlassian.jira.config.properties.JiraSystemPropertiesCache
All Implemented Interfaces:
PropertiesAccessor

public class JiraSystemPropertiesCache
extends Object
implements PropertiesAccessor

This class provides caching of system properties. This is internal implementation used by JiraSystemProperties.

Cache misses are not cached (those returning null). Because of the implementation, cache misses raise NullPointerExceptions which should be avoided.

Since:
v6.1

Field Summary
static int CACHE_CAPACITY
          Capacity of cache
static long CACHE_WRITE_EXPIRY_SECONDS
          Expiry time for the cache.
 
Constructor Summary
JiraSystemPropertiesCache(PropertiesAccessor accessor)
          Constructor exposed currently for testing.
 
Method Summary
 void clear()
           
 Boolean getBoolean(String key)
           
 Integer getInteger(String key)
           
 Long getLong(String key)
           
 Properties getProperties()
          Gets all system properties.
 String getProperty(String key)
           
protected  com.google.common.cache.CacheBuilder<Object,Object> newBuilder()
          Cache builder.
 void refresh()
           
 void refresh(String key)
           
 void setProperties(Properties props)
           
 void setProperty(String key, String value)
           
 void unsetProperty(String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHE_WRITE_EXPIRY_SECONDS

public static final long CACHE_WRITE_EXPIRY_SECONDS
Expiry time for the cache.

See Also:
Constant Field Values

CACHE_CAPACITY

public static final int CACHE_CAPACITY
Capacity of cache

See Also:
Constant Field Values
Constructor Detail

JiraSystemPropertiesCache

public JiraSystemPropertiesCache(PropertiesAccessor accessor)
Constructor exposed currently for testing.

Parameters:
accessor - the proxy object to access properties store.
Method Detail

newBuilder

protected com.google.common.cache.CacheBuilder<Object,Object> newBuilder()
Cache builder. Exposed to mock and test timed eviction.


getProperty

public String getProperty(@Nonnull
                          String key)
Specified by:
getProperty in interface PropertiesAccessor

setProperty

public void setProperty(@Nonnull
                        String key,
                        @Nonnull
                        String value)
Specified by:
setProperty in interface PropertiesAccessor

getBoolean

public Boolean getBoolean(@Nonnull
                          String key)
Specified by:
getBoolean in interface PropertiesAccessor

getInteger

public Integer getInteger(@Nonnull
                          String key)
Specified by:
getInteger in interface PropertiesAccessor

getLong

public Long getLong(@Nonnull
                    String key)
Specified by:
getLong in interface PropertiesAccessor

refresh

public void refresh()
Specified by:
refresh in interface PropertiesAccessor

getProperties

public Properties getProperties()
Gets all system properties. Returns a snapshot of system properties obtain at the time of the call, which may be considered immediately invalid. This is not a live view of the system properties.

Specified by:
getProperties in interface PropertiesAccessor

setProperties

public void setProperties(Properties props)
Specified by:
setProperties in interface PropertiesAccessor

clear

public void clear()

refresh

public void refresh(String key)
Specified by:
refresh in interface PropertiesAccessor

unsetProperty

public void unsetProperty(String key)
Specified by:
unsetProperty in interface PropertiesAccessor


Copyright © 2002-2014 Atlassian. All Rights Reserved.