--- old/src/java.base/share/classes/sun/nio/ch/FileLockTable.java 2018-02-01 15:18:39.000000000 -0800 +++ new/src/java.base/share/classes/sun/nio/ch/FileLockTable.java 2018-02-01 15:18:38.000000000 -0800 @@ -32,57 +32,14 @@ import java.io.FileDescriptor; import java.io.IOException; -abstract class FileLockTable { - protected FileLockTable() { - } - - /** - * Creates and returns a file lock table for a channel that is connected to - * the a system-wide map of all file locks for the Java virtual machine. - */ - public static FileLockTable newSharedFileLockTable(Channel channel, - FileDescriptor fd) - throws IOException - { - return new SharedFileLockTable(channel, fd); - } - - /** - * Adds a file lock to the table. - * - * @throws OverlappingFileLockException if the file lock overlaps - * with an existing file lock in the table - */ - public abstract void add(FileLock fl) throws OverlappingFileLockException; - - /** - * Remove an existing file lock from the table. - */ - public abstract void remove(FileLock fl); - - /** - * Removes all file locks from the table. - * - * @return The list of file locks removed - */ - public abstract List removeAll(); - - /** - * Replaces an existing file lock in the table. - */ - public abstract void replace(FileLock fl1, FileLock fl2); -} - - /** * A file lock table that is over a system-wide map of all file locks. */ -class SharedFileLockTable extends FileLockTable { - +class FileLockTable { /** * A weak reference to a FileLock. *

- * SharedFileLockTable uses a list of file lock references to avoid keeping the + * FileLockTable uses a list of file lock references to avoid keeping the * FileLock (and FileChannel) alive. */ private static class FileLockReference extends WeakReference { @@ -118,13 +75,23 @@ // Locks obtained for this channel private final Set locks; - SharedFileLockTable(Channel channel, FileDescriptor fd) throws IOException { + /** + * Creates and returns a file lock table for a channel that is connected to + * the a system-wide map of all file locks for the Java virtual machine. + */ + public static FileLockTable newFileLockTable(Channel channel, + FileDescriptor fd) + throws IOException + { + return new FileLockTable(channel, fd); + } + + FileLockTable(Channel channel, FileDescriptor fd) throws IOException { this.channel = channel; this.fileKey = FileKey.create(fd); this.locks = ConcurrentHashMap.newKeySet(); } - @Override public void add(FileLock fl) throws OverlappingFileLockException { List list = lockMap.get(fileKey); @@ -176,7 +143,6 @@ } } - @Override public void remove(FileLock fl) { assert fl != null; @@ -201,7 +167,6 @@ } } - @Override public List removeAll() { List result = new ArrayList(); List list = lockMap.get(fileKey); @@ -233,7 +198,6 @@ return result; } - @Override public void replace(FileLock fromLock, FileLock toLock) { // the lock must exist so there must be a list List list = lockMap.get(fileKey);