[9] RFR 8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock

Brian Burkhalter brian.burkhalter at oracle.com
Wed Jan 31 15:58:29 UTC 2018


On Jan 30, 2018, at 11:30 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:

>> I don’t see how to do this. The FileLock already holds a reference to the Channel and if the converse were to obtain there would be circular references and things blocked from being collected.
> I think that is the behavior you are looking for. The FileChannel keeps the FileLocks alives, the FileLocks give the FileChannel alive. If the application discards the reference to both then they will eventually be GC'ed once the entry in the SharedFileLockTable is expunged.

I implemented that and the test in this webrev did not complete normally but timed out.

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


More information about the nio-dev mailing list