Author: markt
Date: Tue Oct 20 09:00:24 2015
New Revision: 1709544
URL: http://svn.apache.org/viewvc?rev=1709544&view=rev
Log:
Pull-up code. No need for this to go all the way to the Endpoint.
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1709544&r1=1709543&r2=1709544&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java Tue Oct
20 09:00:24 2015
@@ -22,7 +22,6 @@ import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -811,34 +810,6 @@ public abstract class AbstractEndpoint<S
SocketStatus socketStatus, boolean dispatch);
- public void executeNonBlockingDispatches(SocketWrapperBase<S>
socketWrapper,
- Iterator<DispatchType> dispatches) {
- /*
- * This method is called when non-blocking IO is initiated by defining
- * a read and/or write listener in a non-container thread. It is called
- * once the non-container thread completes so that the first calls to
- * onWritePossible() and/or onDataAvailable() as appropriate are made
by
- * the container.
- *
- * Processing the dispatches requires (for APR/native at least)
- * that the socket has been added to the waitingRequests queue. This
may
- * not have occurred by the time that the non-container thread
completes
- * triggering the call to this method. Therefore, the coded syncs on
the
- * SocketWrapper as the container thread that initiated this
- * non-container thread holds a lock on the SocketWrapper. The
container
- * thread will add the socket to the waitingRequests queue before
- * releasing the lock on the socketWrapper. Therefore, by obtaining the
- * lock on socketWrapper before processing the dispatches, we can be
- * sure that the socket has been added to the waitingRequests queue.
- */
- synchronized (socketWrapper) {
- while (dispatches != null && dispatches.hasNext()) {
- DispatchType dispatchType = dispatches.next();
- processSocket(socketWrapper, dispatchType.getSocketStatus(),
false);
- }
- }
- }
-
// ------------------------------------------------------- Lifecycle
methods
/*
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=1709544&r1=1709543&r2=1709544&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
20 09:00:24 2015
@@ -555,8 +555,29 @@ public abstract class SocketWrapperBase<
}
- public void executeNonBlockingDispatches(Iterator<DispatchType>
dispatches) {
- endpoint.executeNonBlockingDispatches(this, dispatches);
+ public synchronized void
executeNonBlockingDispatches(Iterator<DispatchType> dispatches) {
+ /*
+ * This method is called when non-blocking IO is initiated by defining
+ * a read and/or write listener in a non-container thread. It is called
+ * once the non-container thread completes so that the first calls to
+ * onWritePossible() and/or onDataAvailable() as appropriate are made
by
+ * the container.
+ *
+ * Processing the dispatches requires (for APR/native at least)
+ * that the socket has been added to the waitingRequests queue. This
may
+ * not have occurred by the time that the non-container thread
completes
+ * triggering the call to this method. Therefore, the coded syncs on
the
+ * SocketWrapper as the container thread that initiated this
+ * non-container thread holds a lock on the SocketWrapper. The
container
+ * thread will add the socket to the waitingRequests queue before
+ * releasing the lock on the socketWrapper. Therefore, by obtaining the
+ * lock on socketWrapper before processing the dispatches, we can be
+ * sure that the socket has been added to the waitingRequests queue.
+ */
+ while (dispatches != null && dispatches.hasNext()) {
+ DispatchType dispatchType = dispatches.next();
+ processSocket(dispatchType.getSocketStatus(), false);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]