On Tue, 21 Nov 2023 22:46:32 GMT, Roger Riggs <rri...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/ref/Reference.java line 489:
>> 
>>> 487:      * <p>If this reference was already enqueued (by the garbage 
>>> collector, or a
>>> 488:      * previous call to {@code enqueue}), this method is <b><i>not 
>>> successful</i></b>,
>>> 489:      * and returns false.
>> 
>> If we're going to talk about successful and unsuccessful calls, we should 
>> define what success is first. I guess that would be something like: if this 
>> ref is registered with a queue and not already enqueued, it is enqueued 
>> successfully and the method returns true. Otherwise, not successful, and 
>> returns false.
>
> This could be worded as a post condition, after the call the ref is enqueued 
> with the queue; the return is true iff the ref was not previously enqueued.
> The enqueuing is not conditional (assuming the queue is non-null).

I'll give that some thought. The enqueuing is not conditional, but the 
_happens-before_ is...

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16644#discussion_r1410031119

Reply via email to