1. /*
  2. * @(#)WeakReference.java 1.11 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.lang.ref;
  11. /**
  12. * Weak reference objects, which do not prevent their referents from being
  13. * made finalizable, finalized, and then reclaimed. Weak references are most
  14. * often used to implement canonicalizing mappings.
  15. *
  16. * <p> Suppose that the garbage collector determines at a certain point in time
  17. * that an object is <a href="package-summary.html#reachability">weakly
  18. * reachable</a>. At that time it will atomically clear all weak references to
  19. * that object and all weak references to any other weakly-reachable objects
  20. * from which that object is reachable through a chain of strong and soft
  21. * references. At the same time it will declare all of the formerly
  22. * weakly-reachable objects to be finalizable. At the same time or at some
  23. * later time it will enqueue those newly-cleared weak references that are
  24. * registered with reference queues.
  25. *
  26. * @version 1.11, 02/02/00
  27. * @author Mark Reinhold
  28. * @since 1.2
  29. */
  30. public class WeakReference extends Reference {
  31. /**
  32. * Creates a new weak reference that refers to the given object. The new
  33. * reference is not registered with any queue.
  34. */
  35. public WeakReference(Object referent) {
  36. super(referent);
  37. }
  38. /**
  39. * Creates a new weak reference that refers to the given object and is
  40. * registered with the given queue.
  41. *
  42. * @throws NullPointerException If the <code>queue</code> argument
  43. * is <code>null</code>
  44. *
  45. */
  46. public WeakReference(Object referent, ReferenceQueue q) {
  47. super(referent, q);
  48. }
  49. }