--- old/src/java.base/share/classes/sun/nio/ch/FileLockImpl.java 2018-01-29 15:25:30.000000000 -0800 +++ new/src/java.base/share/classes/sun/nio/ch/FileLockImpl.java 2018-01-29 15:25:29.000000000 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,12 +26,16 @@ package sun.nio.ch; import java.io.IOException; -import java.nio.channels.*; +import java.nio.channels.AsynchronousFileChannel; +import java.nio.channels.Channel; +import java.nio.channels.ClosedChannelException; +import java.nio.channels.FileChannel; +import java.nio.channels.FileLock; -public class FileLockImpl - extends FileLock +class FileLockImpl extends FileLock { private volatile boolean invalid; + private volatile FileLockListener listener; FileLockImpl(FileChannel channel, long position, long size, boolean shared) { @@ -43,6 +47,10 @@ super(channel, position, size, shared); } + void setFileLockListener(FileLockListener listener) { + this.listener = listener; + } + public boolean isValid() { return !invalid; } @@ -50,6 +58,10 @@ void invalidate() { assert Thread.holdsLock(this); invalid = true; + FileLockListener fll; + if ((fll = listener) != null) { + fll.invalidate(); + } } public synchronized void release() throws IOException {