Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

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 the garbage collector determines at a certain point in time that the referent of a registered guarded reference 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 reclaim or finalize resources, but only to provide hints as to when resources might profitably be considered for reclamation or finalization.

Since:
JDK1.2

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

Methods inherited from class java.lang.ref.Reference
 clear, enqueue, get, isEnqueued
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuardedReference

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

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

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.