diff options
| author | Michael Koch <konqueror@gmx.de> | 2004-01-25 13:26:07 +0000 |
|---|---|---|
| committer | Michael Koch <konqueror@gmx.de> | 2004-01-25 13:26:07 +0000 |
| commit | b360a9cd223dd0e2a2226f6c624f23f845bee112 (patch) | |
| tree | 22cfb79f908e3d8cb0804a6e87ba00337f9ae87c /gnu/java/nio/FileLockImpl.java | |
| parent | 2a093767f0512a0ed4d70b45009340fb250cab65 (diff) | |
| download | classpath-b360a9cd223dd0e2a2226f6c624f23f845bee112.tar.gz | |
2004-01-25 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/FileLockImpl.java:
Fixed filename in copyright.
(released): Removed.
(finalize): New method.
Diffstat (limited to 'gnu/java/nio/FileLockImpl.java')
| -rw-r--r-- | gnu/java/nio/FileLockImpl.java | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/gnu/java/nio/FileLockImpl.java b/gnu/java/nio/FileLockImpl.java index f85d60ad6..9384bf612 100644 --- a/gnu/java/nio/FileLockImpl.java +++ b/gnu/java/nio/FileLockImpl.java @@ -1,5 +1,5 @@ -/* FileChannelImpl.java -- - Copyright (C) 2002 Free Software Foundation, Inc. +/* FileLockImpl.java -- + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -60,20 +60,29 @@ public class FileLockImpl extends FileLock } private FileDescriptor fd; - private boolean released; public FileLockImpl (FileDescriptor fd, FileChannel channel, long position, long size, boolean shared) { super (channel, position, size, shared); this.fd = fd; - this.released = false; + } + + public void finalize() + { + try + { + release(); + } + catch (IOException e) + { + // Ignore this. + } } public boolean isValid () { - return (released - || !channel ().isOpen ()); + return !channel().isOpen(); } private native void releaseImpl () throws IOException; @@ -81,6 +90,5 @@ public class FileLockImpl extends FileLock public synchronized void release () throws IOException { releaseImpl (); - released = true; } } |
