public class PhantomHandle extends PhantomReference<Object> implements HGLiveHandle, Comparable<HGHandle>
An implementation of a live handle that tracks garbage collection activity by
extending PhantomReference
.
Modifier and Type | Field and Description |
---|---|
static ThreadLocal<Boolean> |
returnEnqueued
This is for internal use ONLY.
|
Constructor and Description |
---|
PhantomHandle(Object ref,
HGPersistentHandle persistentHandle,
byte flags,
ReferenceQueue<Object> refQueue) |
Modifier and Type | Method and Description |
---|---|
void |
accessed() |
int |
compareTo(HGHandle h) |
boolean |
equals(Object other) |
Object |
fetchRef()
A getter of the referent that uses reflection to access the field directly.
|
byte |
getFlags() |
HGPersistentHandle |
getPersistent() |
Object |
getRef() |
int |
hashCode() |
void |
storeRef(Object ref)
A setter of the referent.
|
String |
toString() |
get
clear, enqueue, isEnqueued
public static ThreadLocal<Boolean> returnEnqueued
See comments in 'getRef' for information about this variable.
public PhantomHandle(Object ref, HGPersistentHandle persistentHandle, byte flags, ReferenceQueue<Object> refQueue)
public byte getFlags()
getFlags
in interface HGLiveHandle
public HGPersistentHandle getPersistent()
getPersistent
in interface HGHandle
public 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(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 Object getRef()
getRef
in interface HGLiveHandle
public void accessed()
public int compareTo(HGHandle h)
compareTo
in interface Comparable<HGHandle>
Copyright © 2015. All rights reserved.