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

Brian Burkhalter brian.burkhalter at oracle.com
Tue Sep 5 21:47:21 UTC 2017


Hi Roger,

On Sep 5, 2017, at 2:28 PM, Roger Riggs <Roger.Riggs at oracle.com> wrote:

> Can the function to close and invalidate the FileDescriptor be encapsulated
> in FileDescriptor itself?   It would be another method on JavaIOFileDescriptorAccess
> but would bring the handling of close together in one place.

Yes, I have thought about that also. Currently JavaIOFileDescriptorAccess only contains accessor and mutator methods. I do not know whether this implies that it would be unsafe to add methods there which actually perform some function such as closing.

> Currently, there are several places that replicate the code to do that and FileDescriptor
> already has Windows and Unix versions.

I have observed that as well. In particular I compared attach() and closeAll() and they are identical.

> It might also reasonably handle the case where the FileDescriptor has a parent and should or should
> not call the closeables.

Agreed.

> [fyi, in parallel, I'm working on changing FIS/FOS/RandomAccess file to use the Cleaner.]

Thanks,

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


More information about the nio-dev mailing list