struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From musa...@apache.org
Subject svn commit: r722961 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java
Date Wed, 03 Dec 2008 16:38:57 GMT
Author: musachy
Date: Wed Dec  3 08:38:57 2008
New Revision: 722961

URL: http://svn.apache.org/viewvc?rev=722961&view=rev
Log:
 WW-2905 Synchronize on HttpSession rather than session map from context

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java?rev=722961&r1=722960&r2=722961&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java
Wed Dec  3 08:38:57 2008
@@ -32,6 +32,9 @@
 import com.opensymphony.xwork2.util.logging.Logger;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
 import org.apache.struts2.util.TokenHelper;
+import org.apache.struts2.ServletActionContext;
+
+import javax.servlet.http.HttpSession;
 
 
 /**
@@ -212,6 +215,7 @@
         String name = getBackgroundProcessName(proxy);
         ActionContext context = actionInvocation.getInvocationContext();
         Map session = context.getSession();
+        HttpSession httpSession = ServletActionContext.getRequest().getSession(true);
 
         Boolean secondTime  = true;
         if (executeAfterValidationPass) {
@@ -225,7 +229,9 @@
             }
         }
 
-        synchronized (session) {
+        //sync on the real HttpSession as the session from the context is a wrap that is
created
+        //on every request
+        synchronized (httpSession) {
             BackgroundProcess bp = (BackgroundProcess) session.get(KEY + name);
 
             if ((!executeAfterValidationPass || secondTime) && bp == null) {



Mime
View raw message