tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1137390 - /tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
Date Sun, 19 Jun 2011 17:08:59 GMT
Author: markt
Date: Sun Jun 19 17:08:59 2011
New Revision: 1137390

URL: http://svn.apache.org/viewvc?rev=1137390&view=rev
Log:
Add missing sync that triggered test failures on Linux VM post re-factoring

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java?rev=1137390&r1=1137389&r2=1137390&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java Sun Jun 19 17:08:59 2011
@@ -541,30 +541,32 @@ public class JIoEndpoint extends Abstrac
     public boolean processSocketAsync(SocketWrapper<Socket> socket,
             SocketStatus status) {
         try {
-            if (waitingRequests.remove(socket)) {
-                SocketProcessor proc = new SocketProcessor(socket,status);
-                ClassLoader loader = Thread.currentThread().getContextClassLoader();
-                try {
-                    //threads should not be created by the webapp classloader
-                    if (Constants.IS_SECURITY_ENABLED) {
-                        PrivilegedAction<Void> pa = new PrivilegedSetTccl(
-                                getClass().getClassLoader());
-                        AccessController.doPrivileged(pa);
-                    } else {
-                        Thread.currentThread().setContextClassLoader(
-                                getClass().getClassLoader());
-                    }
-                    // During shutdown, executor may be null - avoid NPE
-                    if (!running) {
-                        return false;
-                    }
-                    getExecutor().execute(proc);
-                }finally {
-                    if (Constants.IS_SECURITY_ENABLED) {
-                        PrivilegedAction<Void> pa = new PrivilegedSetTccl(loader);
-                        AccessController.doPrivileged(pa);
-                    } else {
-                        Thread.currentThread().setContextClassLoader(loader);
+            synchronized (socket) {
+                if (waitingRequests.remove(socket)) {
+                    SocketProcessor proc = new SocketProcessor(socket,status);
+                    ClassLoader loader = Thread.currentThread().getContextClassLoader();
+                    try {
+                        //threads should not be created by the webapp classloader
+                        if (Constants.IS_SECURITY_ENABLED) {
+                            PrivilegedAction<Void> pa = new PrivilegedSetTccl(
+                                    getClass().getClassLoader());
+                            AccessController.doPrivileged(pa);
+                        } else {
+                            Thread.currentThread().setContextClassLoader(
+                                    getClass().getClassLoader());
+                        }
+                        // During shutdown, executor may be null - avoid NPE
+                        if (!running) {
+                            return false;
+                        }
+                        getExecutor().execute(proc);
+                    } finally {
+                        if (Constants.IS_SECURITY_ENABLED) {
+                            PrivilegedAction<Void> pa = new PrivilegedSetTccl(loader);
+                            AccessController.doPrivileged(pa);
+                        } else {
+                            Thread.currentThread().setContextClassLoader(loader);
+                        }
                     }
                 }
             }



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


Mime
View raw message