You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2009/03/30 12:16:08 UTC

svn commit: r759905 - /wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java

Author: jcompagner
Date: Mon Mar 30 10:16:08 2009
New Revision: 759905

URL: http://svn.apache.org/viewvc?rev=759905&view=rev
Log:
WebApplication is not thread-safe
made the bufferedResponse Concurrent and the Session specific map synchonized
Issue: WICKET-2191

Modified:
    wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java

Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java?rev=759905&r1=759904&r2=759905&view=diff
==============================================================================
--- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java (original)
+++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java Mon Mar 30 10:16:08 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.wicket.protocol.http;
 
-import java.util.HashMap;
+import java.util.Collections;
 import java.util.Map;
 
 import javax.servlet.ServletContext;
@@ -45,6 +45,7 @@
 import org.apache.wicket.request.target.coding.SharedResourceRequestTargetUrlCodingStrategy;
 import org.apache.wicket.session.ISessionStore;
 import org.apache.wicket.util.collections.MostRecentlyUsedMap;
+import org.apache.wicket.util.concurrent.ConcurrentHashMap;
 import org.apache.wicket.util.file.FileCleaner;
 import org.apache.wicket.util.file.IResourceFinder;
 import org.apache.wicket.util.file.WebApplicationPath;
@@ -110,7 +111,7 @@
 	 * Map of buffered responses that are in progress per session. Buffered responses are
 	 * temporarily stored
 	 */
-	private final Map bufferedResponses = new HashMap();
+	private final Map bufferedResponses = new ConcurrentHashMap();
 
 	/** the default request cycle processor implementation. */
 	private IRequestCycleProcessor requestCycleProcessor;
@@ -458,9 +459,9 @@
 	 * -Dwicket.configuration. If it does not exist check the servlet init parameter (
 	 * <code>&lt;init-param&gt&lt;param-name&gt;configuration&lt;/param-name&gt;</code>). If not
 	 * found check the servlet context init parameter
-	 * <code>&lt;context-param&gt&lt;param-name6gt;configuration&lt;/param-name&gt;</code>). If
-	 * the parameter is "development" (which is default), settings appropriate for development are
-	 * set. If it's "deployment" , deployment settings are used. If development is specified and a
+	 * <code>&lt;context-param&gt&lt;param-name6gt;configuration&lt;/param-name&gt;</code>). If the
+	 * parameter is "development" (which is default), settings appropriate for development are set.
+	 * If it's "deployment" , deployment settings are used. If development is specified and a
 	 * "sourceFolder" init parameter is also set, then resources in that folder will be polled for
 	 * changes.
 	 */
@@ -635,7 +636,7 @@
 		Map responsesPerSession = (Map)bufferedResponses.get(sessionId);
 		if (responsesPerSession == null)
 		{
-			responsesPerSession = new MostRecentlyUsedMap(4);
+			responsesPerSession = Collections.synchronizedMap(new MostRecentlyUsedMap(4));
 			bufferedResponses.put(sessionId, responsesPerSession);
 		}
 		responsesPerSession.put(bufferId, renderedResponse);