home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-20 | 1.9 KB | 60 lines |
- /*
- * @(#)WeakReference.java 1.3 98/03/18
- *
- * Copyright 1997 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
- package java.lang.ref;
-
-
- /**
- * Weak reference objects, for use in implementing simple caches and
- * canonicalizing mappings.
- *
- * <p> A <em>weak</em> reference is a reference object that does not prevent
- * its referent from being made finalizable, finalized, and then reclaimed. If
- * the garbage collector determines at a certain point in time that an object
- * is no longer strongly reachable and has no guarded references, then at that
- * time it will clear all weak references to the object and declare the object
- * to be finalizable. If a weak reference is registered at the moment the
- * garbage collector clears it, then at some later time it will be enqueued.
- *
- * @author Mark Reinhold
- * @see java.lang.ref.Reference
- * @since JDK1.2
- */
-
- public class WeakReference extends Reference {
-
- /**
- * Create a new weak reference that refers to the given object. The new
- * reference is not registered with any queue.
- */
- public WeakReference(Object referent) {
- super(referent);
- this.state = ACTIVE;
- }
-
- /**
- * Create a new weak reference that refers to the given object and is
- * registered with the given queue.
- *
- * @exception NullPointerException If the <code>queue</code> argument
- * is <code>null</code>
- *
- */
- public WeakReference(Object referent, ReferenceQueue q) {
- super(referent, q);
- this.state = ACTIVE;
- }
-
- }
-