tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1710835 - in /tomcat/trunk/java/org/apache/tomcat/util/net: Nio2Endpoint.java SocketWrapperBase.java
Date Tue, 27 Oct 2015 15:16:04 GMT
Author: remm
Date: Tue Oct 27 15:16:04 2015
New Revision: 1710835

URL: http://svn.apache.org/viewvc?rev=1710835&view=rev
Log:
- Add an extra async IO flag I used for testing.
- Blocking should block.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1710835&r1=1710834&r2=1710835&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Tue Oct 27 15:16:04 2015
@@ -954,6 +954,11 @@ public class Nio2Endpoint extends Abstra
             }
         }
 
+        @Override
+        public boolean hasAsyncIO() {
+            return false;
+        }
+
         /**
          * Internal state tracker for scatter/gather operations.
          */
@@ -978,8 +983,8 @@ public class Nio2Endpoint extends Abstra
                 this.check = check;
                 this.handler = handler;
             }
-            private long nBytes = 0;
-            private CompletionState state = CompletionState.PENDING;
+            private volatile long nBytes = 0;
+            private volatile CompletionState state = CompletionState.PENDING;
         }
 
         private class ScatterReadCompletionHandler<A> implements CompletionHandler<Long,
OperationState<A>> {
@@ -1127,6 +1132,9 @@ public class Nio2Endpoint extends Abstra
                 } else {
                     throw new WritePendingException();
                 }
+                if (block && state.state == CompletionState.PENDING && writePending.tryAcquire(timeout,
unit)) {
+                    writePending.release();
+                }
             } catch (InterruptedException e) {
                 handler.failed(e, attachment);
             }

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java?rev=1710835&r1=1710834&r2=1710835&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Tue Oct 27 15:16:04
2015
@@ -662,6 +662,14 @@ public abstract class SocketWrapperBase<
     };
 
     /**
+     * Allows using NIO2 style read/write only for connectors that can
+     * efficiently support it.
+     */
+    public boolean hasAsyncIO() {
+        return false;
+    }
+
+    /**
      * Scatter read. The completion handler will be called once some
      * data has been read or an error occurred. If a CompletionCheck
      * object has been provided, the completion handler will only be



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message