JDK 10 RFR of 8147615: (fc) FileChannelImpl has no finalizer

Alan Bateman Alan.Bateman at oracle.com
Mon Oct 9 13:48:37 UTC 2017



On 07/10/2017 00:06, Brian Burkhalter wrote:
> @@ -113,8 +101,7 @@
>          this.nd = new FileDispatcherImpl();
>          // Register a cleaning action if and only if there is no parent
>          // as the parent will take care of closing the file descriptor.
> -        this.cleanable = parent != null ? null :
> - CleanerFactory.cleaner().register(this, new Closer(fd));
> +        this.cleanable = parent != null ? null : () -> 
> fdAccess.close(fd);
>      }
>
This just creates a Cleanable that invokes close, you are looking for:
     cleaner.register(this, () -> fdAccess.close(fd));

Once you remove this inner class then you could rename cleanable to 
"closer" to make it more readable.

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


More information about the nio-dev mailing list