import java.io.FileDescriptor;
import java.io.IOException;
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileLock;
+import java.nio.channels.*;
import gnu.classpath.Configuration;
+import gnu.java.nio.channels.FileChannelImpl;
/**
* @author Michael Koch
}
}
- private FileDescriptor fd;
+ private FileChannelImpl ch;
- public FileLockImpl (FileDescriptor fd, FileChannel channel, long position,
+ public FileLockImpl (FileChannelImpl channel, long position,
long size, boolean shared)
{
super (channel, position, size, shared);
- this.fd = fd;
+ ch = channel;
}
protected void finalize()
return !channel().isOpen();
}
- private native void releaseImpl () throws IOException;
-
public synchronized void release () throws IOException
{
- releaseImpl ();
+ ch.unlock(position(), size());
}
}
+++ /dev/null
-// natFileLockImpl.cc
-
-/* Copyright (C) 2003 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-#include <config.h>
-
-#include <jvm.h>
-#include <errno.h>
-
-#include <gnu/java/nio/FileLockImpl.h>
-#include <java/io/FileDescriptor.h>
-#include <java/io/IOException.h>
-
-void
-gnu::java::nio::FileLockImpl::releaseImpl ()
-{
- fd->unlock(position(), size());
-}