Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.automation.core.impl
Class SuperKeyedRegistry<K,V>

java.lang.Object
  extended by 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 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

Constructor Summary
SuperKeyedRegistry()
           
 
Method Summary
 void flushCache()
           
 V get(K key)
           
 void put(K key, V value)
           
 V remove(K key)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SuperKeyedRegistry

public SuperKeyedRegistry()
Method Detail

put

public void put(K key,
                V value)

remove

public V remove(K key)

flushCache

public void flushCache()

get

public V get(K key)

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.