Class SuperKeyedRegistry<K,V>
java.lang.Object
org.nuxeo.ecm.automation.core.impl.SuperKeyedRegistry<K,V>
- Direct Known Subclasses:
AdapterKeyedRegistry
,ClassKeyedRegistry
A registry which is inheriting values from super keys. The super key relation is defined by the derived classes by
overriding
getSuperKeys(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 using put(Object, Object)
or remove(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
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
getSuperKeys
(K key) protected boolean
isCachingEnabled
(K key) Override this in order to disable caching some specific keys.protected abstract boolean
void
-
Field Details
-
registry
-
lookup
the cache map used for lookups. Object is used for the value to be able to insert NULL values.
-
-
Constructor Details
-
SuperKeyedRegistry
public SuperKeyedRegistry()
-
-
Method Details
-
put
-
remove
-
flushCache
public void flushCache() -
isRoot
-
getSuperKeys
-
isCachingEnabled
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) -
get
-