Package java.lang.ref
Class FinalizerReference<T>
- java.lang.Object
-
- java.lang.ref.Reference<T>
-
- java.lang.ref.FinalizerReference<T>
-
public final class FinalizerReference<T> extends Reference<T>
-
-
Field Summary
Fields Modifier and Type Field Description static ReferenceQueue<Object>queue-
Fields inherited from class java.lang.ref.Reference
pendingNext
-
-
Constructor Summary
Constructors Constructor Description FinalizerReference(T r, ReferenceQueue<? super T> q)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidadd(Object referent)voidclear()Makes the referentnull.static voidfinalizeAllEnqueued(long timeout)Waits for all currently-enqueued references to be finalized.Tget()Returns the referent of the reference object.static voidremove(FinalizerReference<?> reference)-
Methods inherited from class java.lang.ref.Reference
enqueue, enqueueInternal, isEnqueued
-
-
-
-
Field Detail
-
queue
public static final ReferenceQueue<Object> queue
-
-
Constructor Detail
-
FinalizerReference
public FinalizerReference(T r, ReferenceQueue<? super T> q)
-
-
Method Detail
-
get
public T get()
Description copied from class:ReferenceReturns the referent of the reference object.
-
clear
public void clear()
Description copied from class:ReferenceMakes the referentnull. This does not force the reference object to be enqueued.
-
add
public static void add(Object referent)
-
remove
public static void remove(FinalizerReference<?> reference)
-
finalizeAllEnqueued
public static void finalizeAllEnqueued(long timeout) throws InterruptedExceptionWaits for all currently-enqueued references to be finalized.- Throws:
InterruptedException
-
-