|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jini.jeri.kerberos.KerberosUtil.SoftCache
static class KerberosUtil.SoftCache
A synchronized hash map that only maintains soft reference to its value objects. It can be configured to have a limited capacity. LRU replacement policy is used when capacity limit is reached.
Nested Class Summary | |
---|---|
private class |
KerberosUtil.SoftCache.LRUHashMap
A linked hash map that implements LRU replacement policy |
private static class |
KerberosUtil.SoftCache.ValueCell
An instance of this class maintains a reference to a key, and a soft reference to the value the key maps to. |
Field Summary | |
---|---|
private KerberosUtil.SoftCache.LRUHashMap |
hash
Internal hash map used to store the actual key value pairs |
private ReferenceQueue |
queue
Reference queue for cleared ValueCells |
Constructor Summary | |
---|---|
KerberosUtil.SoftCache()
Construct an instance of the SoftCache, using a default capacity of 8. |
|
KerberosUtil.SoftCache(int maxCacheSize)
Construct an instance of the SoftCache with the given size limit. |
|
KerberosUtil.SoftCache(int maxCacheSize,
int initialCapacity)
Construct an instance of the SoftCache with the given size limit and initial capacity. |
Method Summary | |
---|---|
void |
clear()
Removes all entries in this cache. |
Object |
get(Object key)
If there is a mapping in this cache for the specified key, and the softly referenced value of the mapping has not been garbage collected, return the value, other wise, return null. |
private void |
processQueue()
Process the internal ReferenceQueue |
Object |
put(Object key,
Object value)
Associates the specified value with the specified key in this cache. |
Object |
remove(Object key)
Removes the mapping for this key from this cache if it still exists. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final KerberosUtil.SoftCache.LRUHashMap hash
private ReferenceQueue queue
Constructor Detail |
---|
KerberosUtil.SoftCache()
KerberosUtil.SoftCache(int maxCacheSize)
maxCacheSize
- maximum number of entries allowed in
this cacheKerberosUtil.SoftCache(int maxCacheSize, int initialCapacity)
maxCacheSize
- maximum number of entries allowed in
this cacheinitialCapacity
- initial capacity of the cacheMethod Detail |
---|
public Object put(Object key, Object value)
key
- key with which the specified value is to be
associated.value
- - value to be associated with the specified
key, only a soft reference is maintained to value in
this cache.
public Object get(Object key)
key
- - key whose associated value is to be returned.
public Object remove(Object key)
key
- key whose mapping is to be removed from the cache.
public void clear()
private void processQueue()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |