RFR [6853696] (ref) ReferenceQueue.remove(timeout) may return null even if timeout has not expired

Mandy Chung mandy.chung at oracle.com
Mon Feb 24 22:11:11 UTC 2014


On 2/23/14 9:59 PM, Ivan Gerasimov wrote:
> Hello!
>
> ReferenceQueue.remove(timeout) may return too early, i.e. before the 
> specified timeout has elapsed.
>
> Would you please review the fix?
> The change also includes a regression test, which can be used to 
> demonstrate the issue.
>
> BUGURL: https://bugs.openjdk.java.net/browse/JDK-6853696
> WEBREV: http://cr.openjdk.java.net/~igerasim/6853696/0/webrev/
>

I'll review the patch once you address the numerical overflow issue 
Martin points out.  One minor comment - I suggest to use "start" and 
"end" instead of "before" and "after".

One comment on the test, line 61:  I think you want to check 
thread.suspect expects to be true.  It may be simply keeping the 
returned value of ReferenceQueue.remove call and check that in line 61 
instead of having thread.suspect variable.  line 76: why do you want to 
catch InterruptedException?  If interrupted, should the test fail?

Mandy



More information about the core-libs-dev mailing list