RFR [6853696] (ref) ReferenceQueue.remove(timeout) may return null even if timeout has not expired
Ivan Gerasimov
ivan.gerasimov at oracle.com
Wed Feb 26 22:12:39 UTC 2014
On 26.02.2014 22:43, Mandy Chung wrote:
> On 2/25/2014 11:08 PM, Ivan Gerasimov wrote:
>>> I missed that you remove the strong reference (line 57). I think
>>> it's good to hold the strong reference so that
>>> ReferenceQueue.remove(timeout) will timeout and the test can verify
>>> reliably.
>>>
>> This is an important part.
>> If we didn't remove the strong reference then both threads would wait
>> for the specified period of time even without the fix.
>> The point is to make both threads wake up from lock.wait(timeout),
>> and we do it by removing the strong reference and forcing it be enqueued
>
> Now it becomes clear what the test does (thanks). It'd be helpful to
> add some comments. The test should also verify that only one thread
> gets a non-null reference == weakReference and the other should get a
> null reference in addition to the wait time > TIMEOUT.
>
>
Good point, thank you Mandy. I should have added comments at the very
beginning.
Would you take a look at the last updated webrev, with the suggested
changes?
Sincerely yours,
Ivan
> Mandy
>
>
More information about the core-libs-dev
mailing list