< prev index next >

src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java

Print this page
@@ -290,10 +290,17 @@
          try {
              if (connectionReset)
                  throw new SocketException("Connection reset");
              if (isInputClosed)
                  return -1;
+ 
+             // experimental
+             if (Poller.supportReadOps() && Thread.currentThread().isVirtual()) {
+                 n = Poller.read(fdVal(fd), b, off, len, remainingNanos, this::isOpen);
+                 if (n != IOStatus.UNAVAILABLE) return n;
+             }
+ 
              configureNonBlockingIfNeeded(fd, remainingNanos > 0);
              if (remainingNanos > 0) {
                  // read with timeout
                  n = timedRead(fd, b, off, len, remainingNanos);
              } else {

@@ -415,10 +422,17 @@
      private int implWrite(byte[] b, int off, int len) throws IOException {
          int n = 0;
          SocketException ex = null;
          FileDescriptor fd = beginWrite();
          try {
+ 
+             // experimental
+             if (Poller.supportWriteOps() && Thread.currentThread().isVirtual()) {
+                 n = Poller.write(fdVal(fd), b, off, len, this::isOpen);
+                 if (n != IOStatus.UNAVAILABLE) return n;
+             }
+ 
              configureNonBlockingIfNeeded(fd, false);
              n = tryWrite(fd, b, off, len);
              while (IOStatus.okayToRetry(n) && isOpen()) {
                  park(fd, Net.POLLOUT);
                  n = tryWrite(fd, b, off, len);
< prev index next >