8212132: (dc) Remove DatagramChannelImpl finalize method
Alan Bateman
Alan.Bateman at oracle.com
Mon Oct 28 06:47:25 UTC 2019
On 27/10/2019 17:49, Martin Buchholz wrote:
> :
>
> (also, there's no read-write-lock as one would expect from seeing a
> readLock and a writeLock. But I have no better name (hmmm maybe
> readerLock and writerLock?))
They have been named "readLock" and "writeLock" since 1.4 but you may
have a point.
>
> Wearing my finalization/reachability hat, it looks to me like
> technically a method like
> public int write(ByteBuffer buf)
> needs a reachabilityFence to prevent fd from being closed while in
> use, but in practice no misbehavior will ever be provoked, in part
> because hotspot refuses to hoist final fields into locals.
The channel implementation has a strong reference to the FileDescriptor
so I think you are suggesting that, at least in theory, the channel (fd,
locks, ...) could be GC'ed while a thread is a read/write/send/receive
method. I don't see how the compiler could look through the
endRead/endWrite methods but I'll study it further. Also if we had
issues here then I would expect the IBM folks to speak up as they tend
to find them with their J9 VM.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20191028/f0eab3ac/attachment.html>
More information about the nio-dev
mailing list