public class PhantomHandle extends java.lang.ref.PhantomReference<java.lang.Object> implements HGLiveHandle, java.lang.Comparable<HGHandle>
An implementation of a live handle that tracks garbage collection activity by
extending PhantomReference
.
Modifier and Type | Field and Description |
---|---|
static java.lang.ThreadLocal<java.lang.Boolean> |
returnEnqueued
This is for internal use ONLY.
|
Constructor and Description |
---|
PhantomHandle(java.lang.Object ref,
HGPersistentHandle persistentHandle,
byte flags,
java.lang.ref.ReferenceQueue<java.lang.Object> refQueue) |
Modifier and Type | Method and Description |
---|---|
void |
accessed() |
int |
compareTo(HGHandle h) |
boolean |
equals(java.lang.Object other) |
java.lang.Object |
fetchRef()
A getter of the referent that uses reflection to access the field directly.
|
byte |
getFlags() |
HGPersistentHandle |
getPersistent() |
java.lang.Object |
getRef() |
int |
hashCode() |
void |
storeRef(java.lang.Object ref)
A setter of the referent.
|
java.lang.String |
toString() |
public static java.lang.ThreadLocal<java.lang.Boolean> returnEnqueued
See comments in 'getRef' for information about this variable.
public PhantomHandle(java.lang.Object ref, HGPersistentHandle persistentHandle, byte flags, java.lang.ref.ReferenceQueue<java.lang.Object> refQueue)
public byte getFlags()
getFlags
in interface HGLiveHandle
public HGPersistentHandle getPersistent()
getPersistent
in interface HGHandle
public java.lang.Object fetchRef()
A getter of the referent that uses reflection to access the field directly. Thus, the field is available even after it's finalized. Therefore, this method should only be called if it doesn't result in the referent becoming strongly reachable again.
public void storeRef(java.lang.Object ref)
A setter of the referent. This setter will block the current Thread while the reference is being enqueued by the grabage collector.
ref
- public java.lang.Object getRef()
getRef
in interface HGLiveHandle
public void accessed()
public final int hashCode()
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object