|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.sasl.common.pool.AbstractPool<K,V>
public abstract class AbstractPool<K,V>
Small abstract (shared resource) pool from which specialised pools could be derived. Supports in principle to garbage collect unused pool entries, because a reference counter is sponsored to stored values. The reference counter is only working correctly if resources are allocated and freed by the user.
Nested Class Summary | |
---|---|
protected static class |
AbstractPool.PoolEntry<V>
|
Constructor Summary | |
---|---|
AbstractPool()
|
Method Summary | |
---|---|
protected boolean |
add(K key,
V value)
Adds the value under the given key to the pool, if the key is unknown to the pool. |
boolean |
containsKey(K key)
Returns true, if the key is known to the pool, false else. |
protected void |
free(K key)
Notifies the pool that a reference under the given key is no longer needed. |
protected AbstractPool.PoolEntry<V> |
getPoolEntry(K key)
Returns the pool entry to the corresponding key, or null if the key is unknown to the pool. |
protected V |
retrieve(K key)
Returns the value to the corresponding key from the pool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractPool()
Method Detail |
---|
protected boolean add(K key, V value)
key
- null or non null.value
- null or non null.
protected V retrieve(K key)
key
- null or non null.
public boolean containsKey(K key)
key
- null or non null.
protected void free(K key)
key
- null or non null.protected AbstractPool.PoolEntry<V> getPoolEntry(K key)
key
- null or non null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |