Reference Objects |
JDK 1.2 Contents |
Reference objects reify references in much the same way that Class objects reify Java classes. That is, a reference object encapsulates a reference to some other object so that the reference itself may be examined and manipulated like any other object.OverviewReference objects allow a program to maintain a reference to an object that does not prevent the object from being considered for reclamation by the garbage collector. They also allow a program to be notified some time after the collector has determined that an object has become eligible for reclamation. Reference objects are therefore useful for building simple caches as well as caches that are flushed when memory runs low, for implementing mappings that do not prevent their keys (or values) from being reclaimed, and for scheduling pre-mortem cleanup actions in a more flexible way than is possible with the Java finalization mechanism.
API Specification
(javadoc)
Copyright © 1995-98 Sun Microsystems, Inc. All Rights Reserved. Please send comments to: java-gc-comments@eng.sun.com. This is not a subscription list. |
Java Software |