Class SuperKeyedRegistry<K,V>
- java.lang.Object
-
- org.nuxeo.ecm.automation.core.impl.SuperKeyedRegistry<K,V>
-
- Direct Known Subclasses:
AdapterKeyedRegistry
,ClassKeyedRegistry
public abstract class SuperKeyedRegistry<K,V> extends Object
A registry which is inheriting values from super keys. The super key relation is defined by the derived classes by overridinggetSuperKeys(Object)
method. The registry is thread safe and is optimized for lookups. A concurrent cache is dynamically updated when a value is retrieved from a super entry. The cache is removed each time a modification is made on the registry usingput(Object, Object)
orremove(Object)
methods. Thus, for maximum performance you need to avoid modifying the registry after lookups were done: at application startup build the registry, at runtime perform lookups, at shutdown remove entries. The root key is passed in the constructor and is used to stop looking in super entries.- Author:
- Bogdan Stefanescu
-
-
Constructor Summary
Constructors Constructor Description SuperKeyedRegistry()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
flushCache()
V
get(K key)
protected abstract List<K>
getSuperKeys(K key)
protected boolean
isCachingEnabled(K key)
Override this in order to disable caching some specific keys.protected abstract boolean
isRoot(K key)
void
put(K key, V value)
V
remove(K key)
-
-
-
Method Detail
-
flushCache
public void flushCache()
-
isRoot
protected abstract boolean isRoot(K key)
-
isCachingEnabled
protected boolean isCachingEnabled(K key)
Override this in order to disable caching some specific keys. For example when using java classes as keys you may want to avoid caching proxy classes. The default is to return true. (cache is enabled)
-
-