diff -r f9bcdce2df26 -r 03b4e6dc367b jdk/src/java.base/share/classes/sun/nio/ch/FileLockImpl.java --- a/jdk/src/java.base/share/classes/sun/nio/ch/FileLockImpl.java Wed Jul 05 21:09:59 2017 +0200 +++ b/jdk/src/java.base/share/classes/sun/nio/ch/FileLockImpl.java Mon Dec 21 20:54:00 2015 +0100 @@ -31,7 +31,7 @@ public class FileLockImpl extends FileLock { - private volatile boolean valid = true; + private volatile boolean invalid; FileLockImpl(FileChannel channel, long position, long size, boolean shared) { @@ -44,25 +44,25 @@ } public boolean isValid() { - return valid; + return !invalid; } void invalidate() { assert Thread.holdsLock(this); - valid = false; + invalid = true; } public synchronized void release() throws IOException { Channel ch = acquiredBy(); if (!ch.isOpen()) throw new ClosedChannelException(); - if (valid) { + if (isValid()) { if (ch instanceof FileChannelImpl) ((FileChannelImpl)ch).release(this); else if (ch instanceof AsynchronousFileChannelImpl) ((AsynchronousFileChannelImpl)ch).release(this); else throw new AssertionError(); - valid = false; + invalidate(); } } }