src/share/classes/java/lang/ref/Reference.java
Print this page
*** 87,97 ****
* field is also used for linking Reference objects in the pending list.
*/
private T referent; /* Treated specially by GC */
! ReferenceQueue<? super T> queue;
/* When active: NULL
* pending: this
* Enqueued: next reference in queue (or this if last)
* Inactive: this
--- 87,97 ----
* field is also used for linking Reference objects in the pending list.
*/
private T referent; /* Treated specially by GC */
! volatile ReferenceQueue<? super T> queue;
/* When active: NULL
* pending: this
* Enqueued: next reference in queue (or this if last)
* Inactive: this
*** 223,235 ****
*
* @return <code>true</code> if and only if this reference object has
* been enqueued
*/
public boolean isEnqueued() {
! synchronized (this) {
! return (this.next != null && this.queue == ReferenceQueue.ENQUEUED);
! }
}
/**
* Adds this reference object to the queue with which it is registered,
* if any.
--- 223,233 ----
*
* @return <code>true</code> if and only if this reference object has
* been enqueued
*/
public boolean isEnqueued() {
! return (this.queue == ReferenceQueue.ENQUEUED);
}
/**
* Adds this reference object to the queue with which it is registered,
* if any.