Examples of PhantomReference


Examples of java.lang.ref.PhantomReference

    static Reference ref;

    public static void main(String[] args) throws Exception {
        ReferenceQueue queue = new ReferenceQueue();
        Object referent = new PhantomReferenceTest();
        ref = new PhantomReference(referent, queue);

        // drop strong reference
        referent = null;

        System.gc();
View Full Code Here

Examples of java.lang.ref.PhantomReference

* </pre>
*/
public final class WaitUnreachable {
    public WaitUnreachable(Object obj) {
        queue = new ReferenceQueue();
        ref = new PhantomReference(obj, queue);
    }
View Full Code Here

Examples of java.lang.ref.PhantomReference

     * @param obj the object on which to wait
     */
    public WaitUnreachable(Object obj) {
        this.obj = obj;
        queue = new ReferenceQueue();
        ref = new PhantomReference(obj, queue);
    }
View Full Code Here

Examples of java.lang.ref.PhantomReference

            target = disposerTarget.getDisposerReferent();
        }

        java.lang.ref.Reference ref;
        if (refType == PHANTOM) {
            ref = new PhantomReference(target, queue);
        } else {
            ref = new WeakReference(target, queue);
        }
        records.put(ref, rec);
View Full Code Here

Examples of java.lang.ref.PhantomReference

        if (target instanceof DisposerTarget) {
            target = ((DisposerTarget)target).getDisposerReferent();
        }
        java.lang.ref.Reference ref;
        if (refType == PHANTOM) {
            ref = new PhantomReference(target, queue);
        } else {
            ref = new WeakReference(target, queue);
        }
        records.put(ref, rec);
    }
View Full Code Here

Examples of java.lang.ref.PhantomReference

  private $Finalizer(Class paramClass, Object paramObject)
  {
    super(Finalizer.class.getName());
    this.finalizableReferenceClassReference = new WeakReference(paramClass);
    this.frqReference = new PhantomReference(paramObject, this.queue);
    setDaemon(true);
  }
View Full Code Here

Examples of java.lang.ref.PhantomReference

  }

  private Finalizer(Class paramClass, Object paramObject)
  {
    this.finalizableReferenceClassReference = new WeakReference(paramClass);
    this.frqReference = new PhantomReference(paramObject, this.queue);
  }
View Full Code Here

Examples of java.lang.ref.PhantomReference

 
  private ArrayElement[] array = new ArrayElement[1]
  public void configureReferences() {
    weakReference = new WeakReference(weakReferent);
    softReference = new SoftReference(softReferent);
    phantomReference = new PhantomReference(phantomReferent, new ReferenceQueue());
   
    array[0] = new ArrayElement();
   
    classLoader = this.getClass().getClassLoader();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.