org.apache.ojb.broker.cache
Class ObjectCacheSoftImpl.SoftHashMap

java.lang.Object
  extended by org.apache.ojb.broker.cache.ObjectCacheSoftImpl.SoftHashMap
Enclosing class:
ObjectCacheSoftImpl

public static final class ObjectCacheSoftImpl.SoftHashMap
extends Object

Kind of map using SoftReference to store values


Nested Class Summary
private  class ObjectCacheSoftImpl.SoftHashMap.SoftValue
          Class derived from SoftReference, used to store the key of the map.
 
Field Summary
private  org.apache.commons.collections.LRUMap hardCacheMap
          The FIFO list of hard references, order of last access.
private  HashMap hash
          The internal HashMap that will hold the SoftReference.
private  ReferenceQueue queue
          Reference queue for cleared SoftReference objects.
 
Constructor Summary
ObjectCacheSoftImpl.SoftHashMap(int hardSize)
          Construct a new hash map with the specified size
 
Method Summary
 void clear()
          Clear the map
 Object get(Object key)
          Retrieve the value associated to a given key
private  void processQueue()
          Removes keys and objects that have been garbaged
 Object put(Object key, Object value)
          Put the key, value pair into the HashMap using a SoftValue object
 Object remove(Object key)
          Remove the entry for this key
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hash

private HashMap hash
The internal HashMap that will hold the SoftReference.


hardCacheMap

private org.apache.commons.collections.LRUMap hardCacheMap
The FIFO list of hard references, order of last access.


queue

private ReferenceQueue queue
Reference queue for cleared SoftReference objects.

Constructor Detail

ObjectCacheSoftImpl.SoftHashMap

public ObjectCacheSoftImpl.SoftHashMap(int hardSize)
Construct a new hash map with the specified size

Parameters:
hardSize - the maximum capacity of this map
Method Detail

put

public Object put(Object key,
                  Object value)
Put the key, value pair into the HashMap using a SoftValue object

Parameters:
key - the key
value - the value
Returns:
the old value

get

public Object get(Object key)
Retrieve the value associated to a given key

Parameters:
key - the key
Returns:
the value associated to this key

remove

public Object remove(Object key)
Remove the entry for this key

Parameters:
key - the key
Returns:
the old value

clear

public void clear()
Clear the map


processQueue

private void processQueue()
Removes keys and objects that have been garbaged



Copyright © 2007-2012 The Kuali Foundation. All Rights Reserved.