purpose of FileDispatcher.preClose()
Alan.Bateman at Sun.COM
Wed Jan 30 21:12:12 UTC 2008
Michael Allman wrote:
> I think the problem here is that FileChannelImpl.implCloseChannel()
> calls nd.preClose(fd) before the block that releases its file locks.
> On non-windows, nd.preClose(fd) doesn't just "pre close" fd, it closes
> it. Then implCloseChannel() tries to release its file locks. fd now
> points to a socket descriptor and on Solaris/Linux, such attempt seems
> to be harmless. On Mac OS X, it complains with the EBADF error code.
Yes, this is a known issue but hasn't been a problem to date. I don't
know Mac OS X well but if closing a file causes all advisory locks on
the file to be removed then the simplest solution for your port is
probably to just comment out the call to release0 that is called from
the inner class in implCloseChannel. As you've found this will otherwise
attempt the unlock on the dup'ed file descriptor and fail.
More information about the core-libs-dev