8202252: (aio) Closed AsynchronousSocketChannel keeps completion handler alive

Alan Bateman Alan.Bateman at oracle.com
Mon Jul 2 15:05:18 UTC 2018



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).

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20180702/8a4cefdd/attachment.html>


More information about the nio-dev mailing list