8202252: (aio) Closed AsynchronousSocketChannel keeps completion handler alive

Brian Burkhalter brian.burkhalter at oracle.com
Mon Jul 2 16:44:12 UTC 2018


On Jul 2, 2018, at 8:53 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:

> On 02/07/2018 16:41, Roger Riggs wrote:
>> A bit tidier would be to create a ReferenceQueue so the WeakReference is enqueued when it is ready.
>> Then the test can just wait on it to be enqueued, no sleeping required.
> Yes, that would be better but the main point is that the reference should be to the handler object, it it otherwise not testing the right thing.

The test was emulating what the submitter was trying. I agree however that it is pointless and the handler alone can be tested. Here is an updated version without a ReferenceQueue:

http://cr.openjdk.java.net/~bpb/8202252/webrev.02/

The ugly thing about this version, if it matters, is that when run against the un-patched source the test just hangs instead of failing outright. I can look into the ReferenceQueue if need be.

Thanks,

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20180702/662ba237/attachment-0001.html>


More information about the nio-dev mailing list