< prev index next >

src/java.base/share/classes/java/lang/ref/Reference.java

Print this page

        

@@ -92,14 +92,20 @@
 
     private T referent;         /* Treated specially by GC */
 
     volatile ReferenceQueue<? super T> queue;
 
+    /* When a Reference is de-queued from ReferenceQueue, Reference.next
+     * points to this object.
+     */
+    private static class Dequeued extends Reference<Void> { Dequeued() { super(null); } }
+    static final Reference DEQUEUED = new Dequeued();
+
     /* When active:   NULL
      *     pending:   this
      *    Enqueued:   next reference in queue (or this if last)
-     *    Inactive:   this
+     *    Inactive:   DEQUEUED
      */
     @SuppressWarnings("rawtypes")
     Reference next;
 
     /* When active:   next element in a discovered reference list maintained by GC (or this if last)
< prev index next >