org.castor.cache.hashbelt.container
Class WeakReferenceContainer
java.lang.Object
org.castor.cache.hashbelt.container.WeakReferenceContainer
- Container, Map
public final class WeakReferenceContainer
extends java.lang.Object
An implementation of a container that uses weak references for storing values
in the map, so that values can be removed from the map by the system when the
system is under memory pressure. Keys, however, are kept strong - so contains()
may well find an element, but the value may have been lost. Make sure you test
for null returns from put.
Note that keys are hard references; in a situation where OutOfMemory will
occur, the JVM will first wipe out all unreferenced objects whose only link
is a weak reference. An out of memory will wipe all values from the maps
which are currently unreferenced. The keys remain until the hashbelt
containers are garbage collected, an put is called with that key or when the
value should be accessed through any operation of the Container interface.
$Revision: 5951 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
containsKey
public boolean containsKey(Object key)
java.util.Map.containsKey(java.lang.Object)
containsValue
public boolean containsValue(Object value)
java.util.Map.containsValue(java.lang.Object)
entrySet
public Set entrySet()
get
public Object get(Object key)
java.util.Map.get(java.lang.Object)
isEmpty
public boolean isEmpty()
keySet
public Set keySet()
put
public Object put(Object key,
Object value)
java.util.Map.put(java.lang.Object, java.lang.Object)
putAll
public void putAll(Map map)
java.util.Map.putAll(java.util.Map)
remove
public Object remove(Object key)
java.util.Map.remove(java.lang.Object)
values
public Collection values()
Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com