jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
changeset 14025 fbebe005a3ee
parent 12683 5c743840dd8a
child 16921 e70261f11307
--- a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java	Thu Oct 04 10:04:56 2012 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java	Thu Oct 04 19:53:08 2012 +0100
@@ -914,6 +914,28 @@
         return translateReadyOps(ops, 0, sk);
     }
 
+    // package-private
+    int poll(int events, long timeout) throws IOException {
+        assert Thread.holdsLock(blockingLock()) && !isBlocking();
+
+        synchronized (readLock) {
+            int n = 0;
+            try {
+                begin();
+                synchronized (stateLock) {
+                    if (!isOpen())
+                        return 0;
+                    readerThread = NativeThread.current();
+                }
+                n = Net.poll(fd, events, timeout);
+            } finally {
+                readerCleanup();
+                end(n > 0);
+            }
+            return n;
+        }
+    }
+
     /**
      * Translates an interest operation set into a native poll event set
      */