--- old/jdk/src/share/classes/java/nio/channels/FileLock.java 2010-06-17 21:16:03.000000000 -0700 +++ new/jdk/src/share/classes/java/nio/channels/FileLock.java 2010-06-17 21:16:03.000000000 -0700 @@ -116,7 +116,7 @@ * @since 1.4 */ -public abstract class FileLock { +public abstract class FileLock implements AutoCloseable { private final Channel channel; private final long position; @@ -299,6 +299,17 @@ public abstract void release() throws IOException; /** + * This method invokes the {@link #release} method. It was added + * to the class so that it could be used in conjunction with the + * automatic resource management block construct. + * + * @since 1.7 + */ + public final void close() throws IOException { + release(); + } + + /** * Returns a string describing the range, type, and validity of this lock. * * @return A descriptive string