Class Pool<KeyType,ValueType>

java.lang.Object
ucar.unidata.util.Pool<KeyType,ValueType>
Type Parameters:
KeyType -
ValueType -

public class Pool<KeyType,ValueType> extends Object
Provides a pool of keyed objects and keeps the total size below a given limit. This maps a key to a list of values. The get method is consumptive, it removes the returned value from the list. If the total number of list elements exceed the given cache size this will remove the elements from the list on a key based last used basis
Version:
$Revision: 1.271 $
Author:
IDV development group.
  • Constructor Details

    • Pool

      public Pool(int size)
      ctor
      Parameters:
      size - max size
  • Method Details

    • getMutex

      public Object getMutex()
      _more_
      Returns:
      _more_
    • contains

      public boolean contains(KeyType key)
      _more_
      Parameters:
      key - _more_
      Returns:
      _more_
    • get

      public ValueType get(KeyType key)
      _more_
      Parameters:
      key - _more_
      Returns:
      _more_
    • getFromPool

      protected ValueType getFromPool(List<ValueType> list)
      _more_
      Parameters:
      list - _more_
      Returns:
      _more_
    • containsOrCreate

      public boolean containsOrCreate(KeyType key)
      _more_
      Parameters:
      key - _more_
      Returns:
      _more_
    • put

      public void put(KeyType key, ValueType value)
      _more_
      Parameters:
      key - _more_
      value - _more_
    • getStats

      public void getStats(StringBuffer sb)
      _more_
      Parameters:
      sb - _more_
    • clear

      public void clear()
      Clear the cache
    • getSize

      public int getSize()
      _more_
      Returns:
      _more_
    • createValue

      protected ValueType createValue(KeyType key)
      _more_
      Parameters:
      key - _more_
      Returns:
      _more_
    • removeValue

      protected void removeValue(KeyType key, ValueType object)
      _more_
      Parameters:
      key - _more_
      object - _more_