8154436: Drop code to support Windows XP in windows async channel impl
authorredestad
Mon, 18 Apr 2016 14:01:03 +0200
changeset 37369 770f6e0237e4
parent 37368 bf9b868f1aa8
child 37370 4dcebdd2bbc0
8154436: Drop code to support Windows XP in windows async channel impl Reviewed-by: chegar, alanb
jdk/src/java.base/windows/classes/sun/nio/ch/Iocp.java
jdk/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java
jdk/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousServerSocketChannelImpl.java
jdk/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java
--- a/jdk/src/java.base/windows/classes/sun/nio/ch/Iocp.java	Mon Apr 18 12:36:41 2016 +0200
+++ b/jdk/src/java.base/windows/classes/sun/nio/ch/Iocp.java	Mon Apr 18 14:01:03 2016 +0200
@@ -34,8 +34,6 @@
 import java.util.concurrent.*;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.security.AccessController;
-import sun.security.action.GetPropertyAction;
 import jdk.internal.misc.Unsafe;
 
 /**
@@ -46,7 +44,6 @@
 class Iocp extends AsynchronousChannelGroupImpl {
     private static final Unsafe unsafe = Unsafe.getUnsafe();
     private static final long INVALID_HANDLE_VALUE  = -1L;
-    private static final boolean supportsThreadAgnosticIo;
 
     // maps completion key to channel
     private final ReadWriteLock keyToChannelLock = new ReentrantReadWriteLock();
@@ -90,13 +87,6 @@
         <V,A> PendingFuture<V,A> getByOverlapped(long overlapped);
     }
 
-    /**
-     * Indicates if this operating system supports thread agnostic I/O.
-     */
-    static boolean supportsThreadAgnosticIo() {
-        return supportsThreadAgnosticIo;
-    }
-
     // release all resources
     void implClose() {
         synchronized (this) {
@@ -445,11 +435,5 @@
     static {
         IOUtil.load();
         initIDs();
-
-        // thread agnostic I/O on Vista/2008 or newer
-        String osversion = AccessController.doPrivileged(
-            new GetPropertyAction("os.version"));
-        String vers[] = osversion.split("\\.");
-        supportsThreadAgnosticIo = Integer.parseInt(vers[0]) >= 6;
     }
 }
--- a/jdk/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java	Mon Apr 18 12:36:41 2016 +0200
+++ b/jdk/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java	Mon Apr 18 14:01:03 2016 +0200
@@ -318,20 +318,7 @@
         result.setContext(lockTask);
 
         // initiate I/O
-        if (Iocp.supportsThreadAgnosticIo()) {
-            lockTask.run();
-        } else {
-            boolean executed = false;
-            try {
-                Invoker.invokeOnThreadInThreadPool(this, lockTask);
-                executed = true;
-            } finally {
-                if (!executed) {
-                    // rollback
-                    removeFromFileLockTable(fli);
-                }
-            }
-        }
+        lockTask.run();
         return result;
     }
 
@@ -556,11 +543,7 @@
         result.setContext(readTask);
 
         // initiate I/O
-        if (Iocp.supportsThreadAgnosticIo()) {
-            readTask.run();
-        } else {
-            Invoker.invokeOnThreadInThreadPool(this, readTask);
-        }
+        readTask.run();
         return result;
     }
 
@@ -730,11 +713,7 @@
         result.setContext(writeTask);
 
         // initiate I/O
-        if (Iocp.supportsThreadAgnosticIo()) {
-            writeTask.run();
-        } else {
-            Invoker.invokeOnThreadInThreadPool(this, writeTask);
-        }
+        writeTask.run();
         return result;
     }
 
--- a/jdk/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousServerSocketChannelImpl.java	Mon Apr 18 12:36:41 2016 +0200
+++ b/jdk/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousServerSocketChannelImpl.java	Mon Apr 18 14:01:03 2016 +0200
@@ -342,11 +342,7 @@
             throw new AcceptPendingException();
 
         // initiate I/O
-        if (Iocp.supportsThreadAgnosticIo()) {
-            task.run();
-        } else {
-            Invoker.invokeOnThreadInThreadPool(this, task);
-        }
+        task.run();
         return result;
     }
 
--- a/jdk/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java	Mon Apr 18 12:36:41 2016 +0200
+++ b/jdk/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java	Mon Apr 18 14:01:03 2016 +0200
@@ -378,11 +378,7 @@
         result.setContext(task);
 
         // initiate I/O
-        if (Iocp.supportsThreadAgnosticIo()) {
-            task.run();
-        } else {
-            Invoker.invokeOnThreadInThreadPool(this, task);
-        }
+        task.run();
         return result;
     }