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

Alan Bateman Alan.Bateman at oracle.com
Wed Jan 31 07:30:40 UTC 2018

On 31/01/2018 03:04, Brian Burkhalter 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.


More information about the nio-dev mailing list