|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.bea.domingo.cache.AbstractBaseCache
public abstract class AbstractBaseCache
Simple cache implementation using a HashMap. Note that this implementation is not synchronized. If multiple threads access this cache concurrently, and at least one of the threads modifies the cache structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more mappings; merely changing the value associated with a key that an instance already contains is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the map. If no such object exists, the map should be "wrapped" using the Collections.synchronizedMap method. This is best done at creation time, to prevent accidental unsynchronized access to the map:
Map map = Collections.synchronizedMap(new HashMap(...));
Constructor Summary | |
---|---|
AbstractBaseCache()
Constructor. |
Method Summary | |
---|---|
protected abstract java.util.Map |
createMap()
Creates the map to be used with the cache. |
protected java.util.Map |
getMap()
Protected getter for map attribute to allow concrete classes to access the map. |
int |
size()
Returns the number of elements in this cache (its cardinality). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.bea.domingo.cache.Cache |
---|
clear, containsKey, get, keySet, put, remove, values |
Constructor Detail |
---|
public AbstractBaseCache()
Method Detail |
---|
protected final java.util.Map getMap()
protected abstract java.util.Map createMap()
Concrete classes must implement this method and create a concrete map for the cache.
public final int size()
size
in interface Cache
Cache.size()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |