Class PhantomReference<T>
java.lang.Object
java.lang.ref.Reference<T>
java.lang.ref.PhantomReference<T>
PhantomReference objects are used to detect referents which
are no longer visible and are eligible to have their storage
reclaimed.
- Since:
- JDK1.2
-
Constructor Summary
ConstructorsConstructorDescriptionPhantomReference(T r, ReferenceQueue<? super T> q) Constructs a new instance of this class. -
Method Summary
Methods declared in class Reference
clear, clone, enqueue, isEnqueued, reachabilityFence, refersToModifier and TypeMethodDescriptionvoidclear()Make the referent null.protected Objectclone()This method will always throw CloneNotSupportedException.booleanenqueue()Force the reference object to be enqueued if it has been associated with a queue.booleanDeprecated.Use ReferenceQueue or Reference.refersTo(null).static voidreachabilityFence(Object ref) Used to keep the referenced object strongly reachable so that it is not reclaimable by garbage collection.final booleanDoes this object refer totarget?Methods declared in class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionbooleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
PhantomReference
Constructs a new instance of this class.- Parameters:
r- referent to track.q- queue to register to the reference object with.
-
-
Method Details
-
get
-