You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jr...@apache.org on 2010/10/15 19:27:22 UTC

svn commit: r1023028 - /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Session.java

Author: jrthomerson
Date: Fri Oct 15 17:27:21 2010
New Revision: 1023028

URL: http://svn.apache.org/viewvc?rev=1023028&view=rev
Log:
fixes problems in WICKET-3108

Modified:
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Session.java

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Session.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Session.java?rev=1023028&r1=1023027&r2=1023028&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Session.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Session.java Fri Oct 15 17:27:21 2010
@@ -921,7 +921,7 @@ public abstract class Session implements
 		final int maxPageMaps = getApplication().getSessionSettings().getMaxPageMaps();
 		synchronized (usedPageMaps)
 		{
-			if (usedPageMaps.size() >= maxPageMaps)
+			while (usedPageMaps.size() >= maxPageMaps)
 			{
 				IPageMap pm = usedPageMaps.getFirst();
 				pm.remove();
@@ -931,6 +931,7 @@ public abstract class Session implements
 		// Create new page map
 		final IPageMap pageMap = getSessionStore().createPageMap(name);
 		setAttribute(attributeForPageMapName(name), pageMap);
+		dirtyPageMap(pageMap);
 		dirty();
 		return pageMap;
 	}
@@ -971,6 +972,10 @@ public abstract class Session implements
 			usedPageMaps.remove(pageMap);
 		}
 
+		// the page map also needs to be removed from the dirty objects list or
+		// the requestDetached method will end up adding it back into session
+		getDirtyObjectsList().remove(pageMap);
+
 		removeAttribute(attributeForPageMapName(pageMap.getName()));
 		dirty();
 	}
@@ -1351,14 +1356,13 @@ public abstract class Session implements
 	 */
 	void dirtyPageMap(final IPageMap map)
 	{
-		if (!map.isDefault())
+
+		synchronized (usedPageMaps)
 		{
-			synchronized (usedPageMaps)
-			{
-				usedPageMaps.remove(map);
-				usedPageMaps.addLast(map);
-			}
+			usedPageMaps.remove(map);
+			usedPageMaps.addLast(map);
 		}
+
 		List<IClusterable> dirtyObjects = getDirtyObjectsList();
 		if (!dirtyObjects.contains(map))
 		{