All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.lang.ref.GuardedReference

java.lang.Object
    |
    +----java.lang.ref.Reference
            |
            +----java.lang.ref.GuardedReference

public class GuardedReference
extends Reference
Guarded reference objects, for use in implementing caches.

A guarded reference is the strongest type of reference object. If a guarded reference is registered and the garbage collector determines at a certain point in time that its referent is no longer strongly reachable, then at some later time the collector will enqueue the guarded reference.

Note that the referent of a guarded reference may be strongly reachable at the time that the reference is removed from its queue. Another guarded reference referring to the same object may already have been removed from some queue (perhaps even the same queue) and the referent made strongly reachable again. Thus guarded references should not be used to finalize or reclaim resources, but only to provide hints as to when resources might profitably be considered for finalization or reclamation.

Since:
JDK1.2
See Also:
Reference

Constructor Index

 o GuardedReference(Object)
Create a new guarded reference that refers to the given object.
 o GuardedReference(Object, ReferenceQueue)
Create a new guarded reference that refers to the given object and is registered with the given queue.

Constructors

 o GuardedReference
public GuardedReference(Object referent)
Create a new guarded reference that refers to the given object. The new reference is not registered with any queue.

 o GuardedReference
public GuardedReference(Object referent,
                        ReferenceQueue q)
Create a new guarded reference that refers to the given object and is registered with the given queue.

Throws: NullPointerException
If the queue argument is null

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature