ReferenceT


Reference<T> java.lang.ref

Java 1.2

This abstract class represents some type of indirect reference to a referent . get( ) returns the referent if the reference has not been explicitly cleared by the clear( ) method or implicitly cleared by the garbage collector. There are three concrete subclasses of Reference . The garbage collector handles these subclasses differently and clears their references under different circumstances.

Each of the subclasses of Reference defines a constructor that allows a ReferenceQueue to be associated with the Reference object. The garbage collector places Reference objects onto their associated ReferenceQueue objects to provide notification about the state of the referent object. isEnqueued( ) tests whether a Reference has been placed on the associated queue, and enqueue( ) explicitly places it on the queue. enqueue( ) returns false if the Reference object does not have an associated ReferenceQueue , or if it has already been enqueued.

 public abstract class  Reference<T>  {  // No Constructor   // Public Instance Methods  public void  clear  ( );        public boolean  enqueue  ( );        public T  get  ( );        public boolean  isEnqueued  ( );   } 

Subclasses

PhantomReference , SoftReference , WeakReference

Returned By

ReferenceQueue.{poll( ) , remove( )}



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net