--- a/jdk/src/windows/classes/sun/nio/ch/FileDispatcherImpl.java Fri Oct 22 09:20:09 2010 +0100
+++ b/jdk/src/windows/classes/sun/nio/ch/FileDispatcherImpl.java Fri Oct 22 17:40:31 2010 +0100
@@ -26,10 +26,11 @@
package sun.nio.ch;
import java.io.*;
+import sun.misc.SharedSecrets;
+import sun.misc.JavaIOFileDescriptorAccess;
class FileDispatcherImpl extends FileDispatcher
{
-
static {
Util.load();
}
@@ -94,6 +95,16 @@
close0(fd);
}
+ FileDescriptor duplicateForMapping(FileDescriptor fd) throws IOException {
+ // on Windows we need to keep a handle to the file
+ JavaIOFileDescriptorAccess fdAccess =
+ SharedSecrets.getJavaIOFileDescriptorAccess();
+ FileDescriptor result = new FileDescriptor();
+ long handle = duplicateHandle(fdAccess.getHandle(fd));
+ fdAccess.setHandle(result, handle);
+ return result;
+ }
+
//-- Native methods
static native int read0(FileDescriptor fd, long address, int len)
@@ -132,4 +143,5 @@
static native void closeByHandle(long fd) throws IOException;
+ static native long duplicateHandle(long fd) throws IOException;
}