JDK 9 RFR of 8152085: (ch) RandomAccessFile.getChannel().lock() is uninterruptible
Alan.Bateman at oracle.com
Thu Jan 26 21:50:58 UTC 2017
On 26/01/2017 20:37, Brian Burkhalter wrote:
> Please review at your convenience.
> Issue: https://bugs.openjdk.java.net/browse/JDK-8152085
> Patch: http://cr.openjdk.java.net/~bpb/8152085/webrev.00/
> On Windows, when a file is locked by one process via a FileChannel, and a second process attempts a blocking lock on the same file via a FileChannel, then the thread blocking on the lock call cannot be interrupted. This patch fixes the problem by replacing the blocking lock call with polling a non-blocking lock call. I am not at all sure that this is a good solution, so should someone else have a better idea about it that they would like to share I would be happy to read it.
Yeah, this is gross. This issue dates back to JDK 1.4 and I think it
needs further thought to see if are other APIs that we could use.
More information about the nio-dev