Package ucar.unidata.util
Class Pool<KeyType,ValueType>
java.lang.Object
ucar.unidata.util.Pool<KeyType,ValueType>
- Type Parameters:
KeyType
-ValueType
-
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the cacheboolean
_more_boolean
containsOrCreate
(KeyType key) _more_protected ValueType
createValue
(KeyType key) _more__more_protected ValueType
getFromPool
(List<ValueType> list) _more_getMutex()
_more_int
getSize()
_more_void
getStats
(StringBuffer sb) _more_void
_more_protected void
removeValue
(KeyType key, ValueType object) _more_
-
Constructor Details
-
Pool
public Pool(int size) ctor- Parameters:
size
- max size
-
-
Method Details
-
getMutex
_more_- Returns:
- _more_
-
contains
_more_- Parameters:
key
- _more_- Returns:
- _more_
-
get
_more_- Parameters:
key
- _more_- Returns:
- _more_
-
getFromPool
_more_- Parameters:
list
- _more_- Returns:
- _more_
-
containsOrCreate
_more_- Parameters:
key
- _more_- Returns:
- _more_
-
put
_more_- Parameters:
key
- _more_value
- _more_
-
getStats
_more_- Parameters:
sb
- _more_
-
clear
public void clear()Clear the cache -
getSize
public int getSize()_more_- Returns:
- _more_
-
createValue
_more_- Parameters:
key
- _more_- Returns:
- _more_
-
removeValue
_more_- Parameters:
key
- _more_object
- _more_
-