@@ -411,14 +411,35 @@ void clearInactiveFinalReference() {
411
411
/* -- Queue operations -- */
412
412
413
413
/**
414
- * Tells whether or not this reference object has been enqueued, either by
415
- * the program or by the garbage collector. If this reference object was
416
- * not registered with a queue when it was created, then this method will
417
- * always return {@code false}.
418
- *
419
- * @return {@code true} if and only if this reference object has
420
- * been enqueued
414
+ * Tests if this reference object is in its associated queue, if any.
415
+ * This method returns {@code true} only if all of the following conditions
416
+ * are met:
417
+ * <ul>
418
+ * <li>this reference object was registered with a queue when it was created; and
419
+ * <li>the garbage collector has added this reference object to the queue
420
+ * or {@link #enqueue()} is called; and
421
+ * <li>this reference object is not yet removed from the queue.
422
+ * </ul>
423
+ * Otherwise, this method returns {@code false}.
424
+ * This method may return {@code false} if this reference object has been cleared
425
+ * but not enqueued due to the race condition.
426
+ *
427
+ * @deprecated
428
+ * This method was originally specified to test if a reference object has
429
+ * been cleared and enqueued but was never implemented to do this test.
430
+ * This method could be misused due to the inherent race condition
431
+ * or without an associated {@code ReferenceQueue}.
432
+ * An application relying on this method to release critical resources
433
+ * could cause serious performance issue.
434
+ * An application should use {@link ReferenceQueue} to reliably determine
435
+ * what reference objects that have been enqueued or
436
+ * {@link #refersTo(Object) refersTo(null)} to determine if this reference
437
+ * object has been cleared.
438
+ *
439
+ * @return {@code true} if and only if this reference object is
440
+ * in its associated queue (if any).
421
441
*/
442
+ @ Deprecated (since ="16" )
422
443
public boolean isEnqueued () {
423
444
return (this .queue == ReferenceQueue .ENQUEUED );
424
445
}
0 commit comments