8202252: (aio) Closed AsynchronousSocketChannel keeps completion handler alive
Roger Riggs
roger.riggs at oracle.com
Mon Jul 2 15:41:54 UTC 2018
Hi,
On 7/2/18 11:05 AM, Alan Bateman wrote:
>
>
> On 27/06/2018 19:12, Brian Burkhalter wrote:
>> On Jun 27, 2018, at 8:25 AM, Alan Bateman <Alan.Bateman at oracle.com
>> <mailto:Alan.Bateman at oracle.com>> wrote:
>>
>>> The change to set connectHandler to null needs more checking, I
>>> can't immediately say if this if right.
>>
>> The only lines in the (new) code where connectHandler is used are:
>>
>> implConnect()
>> 340: set connectHandler instance variable from parameter passed in
>>
>> finishConnect()
>> 275:assign a local variable ‘handler’ from connectHandler instance
>> variable
>> 276: set connectHandler to null
> Okay.
>
>> Updated: http://cr.openjdk.java.net/~bpb/8202252/webrev.01/
>> <http://cr.openjdk.java.net/%7Ebpb/8202252/webrev.01/>
>>
> This looks better but shouldn't the weak reference to be handler
> rather than obj? Also if the System.gc is moved to the
> waitForRefToClear then it will allow you to remove the lengthy
> sleep(1000).
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.
$.02, Roger
>
> -Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20180702/f4f3b5c3/attachment.html>
More information about the nio-dev
mailing list