|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jini.collection.WeakSoftTable
public final class WeakSoftTable
A table that maps a key containing a weak reference to one or more values containing soft references. The weakly-referenced object in a key are compared for identity using ==. Entries are removed when either weak references in keys or soft references in values are cleared. Callers must insure that instances of this class are not accessed concurrently while they are being modified.
Nested Class Summary | |
---|---|
static interface |
WeakSoftTable.RemovableReference
Implemented by classes to permit copying instances into reference queues when they are added to the table and to remove them from the table when the references are cleared. |
static class |
WeakSoftTable.SoftValue
A value that maintains a soft reference to an object. |
static class |
WeakSoftTable.WeakKey
A key that maintains a weak reference to an object which should be compared by object identity. |
Field Summary | |
---|---|
private Map |
hash
Hash table mapping WeakKeys to Lists of SoftValues. |
private ReferenceQueue |
queue
Reference queue for cleared keys and values. |
Constructor Summary | |
---|---|
WeakSoftTable()
Creates an instance of this class. |
Method Summary | |
---|---|
void |
add(WeakSoftTable.WeakKey key,
WeakSoftTable.SoftValue value)
Associates an additional value with the specified key. |
WeakSoftTable.SoftValue |
get(WeakSoftTable.WeakKey key,
int index)
Returns the value associated with the specified key and index, or null if not found. |
private void |
processQueue()
Removes all invalidated entries from the map, that is, removes all entries whose keys or values have been discarded. |
WeakSoftTable.SoftValue |
remove(WeakSoftTable.WeakKey key,
int index)
Removes and returns the index'th value associated with the specified key. |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final Map hash
private final ReferenceQueue queue
Constructor Detail |
---|
public WeakSoftTable()
Method Detail |
---|
private void processQueue()
public WeakSoftTable.SoftValue get(WeakSoftTable.WeakKey key, int index)
public void add(WeakSoftTable.WeakKey key, WeakSoftTable.SoftValue value)
public WeakSoftTable.SoftValue remove(WeakSoftTable.WeakKey key, int index)
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |