|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sape.carbon.core.config.cache.SynchronizedConfigurationCache
This implementation uses a synchronized hash map to store all configurations. This is a bottleneck and may be a point of contention when many threads required configurations simultaniously.
Configuration objects are cached lazily, i.e. they are cached after they are requested the first time. Once a configuration object is cached, the cache will listen for Node events on the configuration. If a node event occurs, the entire cache is cleared. This is done to prevent inconsistencies between this cache and caches internal to the configuration objects themselves in the case of nested configurations.
Copyright 2002 Sapient
Field Summary | |
private Map |
cache
Holds a synchronized cache of value. |
private ConfigurationService |
configService
Holds the config service being cached. |
private org.apache.commons.logging.Log |
log
Provides a handle to Apache-commons logger |
Constructor Summary | |
SynchronizedConfigurationCache(ConfigurationService configService)
Constructs a new SynchronizedConfigurationCache. |
Method Summary | |
Configuration |
getConfiguration(String name)
Gets back a configuration with the given name. |
private Configuration |
loadConfiguration(String name)
Synchronized method to load configurations. |
void |
nodeChanged(Node changedNode)
Updates the configuration cache with the new instance of the node. |
void |
nodeRemoved(String removedNodeName)
Removes the node from the cache. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private org.apache.commons.logging.Log log
private Map cache
private ConfigurationService configService
Constructor Detail |
public SynchronizedConfigurationCache(ConfigurationService configService)
configService
- the service to cacheMethod Detail |
public Configuration getConfiguration(String name)
getConfiguration
in interface ConfigurationCache
name
- the name of the configuration to load
ConfigurationNotFoundException
- indicates there is
no configuration at the given namepublic void nodeChanged(Node changedNode)
nodeChanged
in interface NodeEventListener
changedNode
- the node that has been changedpublic void nodeRemoved(String removedNodeName)
nodeRemoved
in interface NodeEventListener
removedNodeName
- name of the node to removeprivate Configuration loadConfiguration(String name)
name
- name of the requested configuration
ConfigurationNotFoundException
- indicates there is
no configuration at the given name
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |