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

svn commit: r464056 - /incubator/wicket/trunk/wicket/src/main/java/wicket/Session.java

Author: ehillenius
Date: Sat Oct 14 16:26:26 2006
New Revision: 464056

URL: http://svn.apache.org/viewvc?view=rev&rev=464056
Log:
tweak

Modified:
    incubator/wicket/trunk/wicket/src/main/java/wicket/Session.java

Modified: incubator/wicket/trunk/wicket/src/main/java/wicket/Session.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/main/java/wicket/Session.java?view=diff&rev=464056&r1=464055&r2=464056
==============================================================================
--- incubator/wicket/trunk/wicket/src/main/java/wicket/Session.java (original)
+++ incubator/wicket/trunk/wicket/src/main/java/wicket/Session.java Sat Oct 14 16:26:26 2006
@@ -169,7 +169,7 @@
 	private FeedbackMessages feedbackMessages = new FeedbackMessages(
 			new CopyOnWriteArrayList<FeedbackMessage>());
 
-	private transient Map<PageMap, Thread> pageMapsUsedInRequest;
+	private transient Map<PageMap, Thread> pageMapsUsedInRequest = new HashMap<PageMap, Thread>(3);
 
 	/** cached id because you can't access the id after session unbound */
 	private String id = null;
@@ -460,19 +460,15 @@
 			{
 				long startTime = System.currentTimeMillis();
 
-				if (pageMapsUsedInRequest == null)
-				{
-					pageMapsUsedInRequest = new HashMap<PageMap, Thread>(3);
-				}
-
 				// Get page entry for id and version
 				Thread t = pageMapsUsedInRequest.get(pageMap);
 				while (t != null && t != Thread.currentThread())
 				{
 					try
 					{
+						// TODO make longer and configurable
 						pageMapsUsedInRequest.wait(20000); // wait 20 seconds
-															// max.
+						// max.
 					}
 					catch (InterruptedException ex)
 					{
@@ -1092,23 +1088,19 @@
 	 */
 	final void requestDetached()
 	{
-		if (pageMapsUsedInRequest != null)
+		synchronized (pageMapsUsedInRequest)
 		{
-			synchronized (pageMapsUsedInRequest)
+			Thread t = Thread.currentThread();
+			Iterator<Map.Entry<PageMap, Thread>> it = pageMapsUsedInRequest.entrySet().iterator();
+			while (it.hasNext())
 			{
-				Thread t = Thread.currentThread();
-				Iterator<Map.Entry<PageMap, Thread>> it = pageMapsUsedInRequest.entrySet()
-						.iterator();
-				while (it.hasNext())
+				Entry<PageMap, Thread> entry = it.next();
+				if (entry.getValue() == t)
 				{
-					Entry<PageMap, Thread> entry = it.next();
-					if (entry.getValue() == t)
-					{
-						it.remove();
-					}
+					it.remove();
 				}
-				pageMapsUsedInRequest.notifyAll();
 			}
+			pageMapsUsedInRequest.notifyAll();
 		}
 	}