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

Roger Riggs Roger.Riggs at Oracle.com
Tue Oct 10 14:09:35 UTC 2017


Hi Brian,

Right, looks good.

Roger


On 10/9/2017 3:03 PM, Brian Burkhalter wrote:
> OK, here’s a version which is not brain-dead:
>
> http://cr.openjdk.java.net/~bpb/8147615/webrev.03/ 
> <http://cr.openjdk.java.net/%7Ebpb/8147615/webrev.03/>
>
> I should not that the test passes without using a final local 
> FileDescriptor variable:
>
> --- a/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java
> +++ b/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java
> @@ -101,9 +101,8 @@
>          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.
> -        final FileDescriptor fdl = fd;
>          this.cleanable = parent != null ? null :
> - CleanerFactory.cleaner().register(this, () -> fdAccess.close(fdl));
> + CleanerFactory.cleaner().register(this, () -> fdAccess.close(fd));
>
> Thanks,
>
> Brian


More information about the nio-dev mailing list