|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ref.Reference<T>
java.lang.ref.WeakReference
com.sun.jini.jeri.internal.runtime.WeakKey
public final class WeakKey
WeakKey objects are used by the object table to hold weak references to DGC-enabled remote objects in the exported object table, so that such a remote object with no known client references may be (locally) garbage collected. In order for WeakKey objects to be used as keys in the object table, this class extends java.lang.ref.WeakReference to override the hashCode and equals methods such that WeakKey objects hash and compare to each other according to the identity of their referents. The identity-based comparison is necessary to insulate the runtime from arbitrary remote implementation classes' notions of object equality.
Field Summary | |
---|---|
private int |
hash
saved value of the referent's identity hash code, to maintain a consistent hash code after the referent has been cleared |
Constructor Summary | |
---|---|
WeakKey(Object obj)
Create a new WeakKey to the given object. |
|
WeakKey(Object obj,
ReferenceQueue refQueue)
Create a new WeakKey to the given object, registered with a queue. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Returns true if the given object is this identical WeakKey instance, or, if this object's referent has not been cleared, if the given object is another WeakKey instance with the identical non-null referent as this one. |
int |
hashCode()
Returns the identity hash code of the original referent. |
Methods inherited from class java.lang.ref.Reference |
---|
clear, enqueue, get, isEnqueued |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final int hash
Constructor Detail |
---|
public WeakKey(Object obj)
public WeakKey(Object obj, ReferenceQueue refQueue)
Method Detail |
---|
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |