/** * Implement this method to support the provided subclass implementations. * Initialize a newly created reference object. Associate the reference * object with the referent, and the specified ReferenceQueue. * * @param r the referent * @param q the ReferenceQueue */ protected internal virtual void initReference(T r, ReferenceQueue <T> q) { return; }
/** * Constructs a new weak reference to the given referent. The newly created * reference is registered with the given reference queue. * * @param r the referent to track * @param q the queue to register to the reference object with. A null value * results in a weak reference that is not associated with any * queue. */ public WeakReference(T r, ReferenceQueue <T> q) { this.initReference(r, q); }
protected internal override void initReference(T r, ReferenceQueue <T> q) { this.instance.Target = r; q.enqueue(this); // CHECKIT: check other java.lang.ref.Refence.java methods to overwrite }
/* * Constructs a new weak reference to the given referent. The newly created * reference is registered with the given reference queue. * * @param r the referent to track * @param q the queue to register to the reference object with. A null value * results in a weak reference that is not associated with any * queue. */ public WeakReference(T r, ReferenceQueue <T> q) : base() { initReference(r, q); }