java - AbstractQueuedSynchronizer help gc? -


i learning aqs (abstractqueuedsynchronizer) now, confused acquirequeued method:

   final boolean acquirequeued(final node node, int arg) {         boolean failed = true;         try {             boolean interrupted = false;             (;;) {                 final node p = node.predecessor();                 if (p == head && tryacquire(arg)) {                     sethead(node);                     p.next = null; // gc                     failed = false;                     return interrupted;                 }                 if (shouldparkafterfailedacquire(p, node) &&                     parkandcheckinterrupt())                     interrupted = true;             }         } {             if (failed)                 cancelacquire(node);         }     } 

specifically line p.next = null; // gc - how can gc?


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -