Skip to content

Commit

Permalink
Updates to clear() and enqueue()
Browse files Browse the repository at this point in the history
  • Loading branch information
bchristi-git committed Jan 25, 2024
1 parent 3647f64 commit 7eb3397
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/java.base/share/classes/java/lang/ref/Reference.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ boolean refersToImpl(T obj) {
* object, and the garbage collector will no longer clear or enqueue this
* object.
*
* <p>When the garbage collector
* clears references it does so directly, without invoking this method.
* <p>When the garbage collector or the {@link #enqueue()} method clear
* references they do so directly, without invoking this method.
*
* @apiNote
* There is a potential race condition with the garbage collector. When this
Expand Down Expand Up @@ -498,14 +498,15 @@ public boolean isEnqueued() {
* or {@link ReferenceQueue#remove}. <b><i>Unsuccessful</i></b>
* {@code enqueue} calls have no specified memory consistency effects.
*
* <p>When the garbage collector
* clears and enqueues references it does so directly, without invoking this
* method or the {@link #clear()} method.
* <p> When this method clears references it does so directly, without
* invoking the {@link #clear()} method. When the garbage collector clears
* and enqueues references it does so directly, without invoking the
* {@link #clear()} method or this method.
*
* @apiNote
* Use of this method allows the registered queue's
* {@link ReferenceQueue#poll} and {@link ReferenceQueue#remove} methods
* to return this reference even though the referent is still strongly
* to return this reference even though the referent may still be strongly
* reachable.
*
* @return {@code true} if this reference object was successfully
Expand Down

0 comments on commit 7eb3397

Please sign in to comment.