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 2006/10/15 03:46:46 UTC
svn commit: r464094 -
/incubator/wicket/trunk/wicket/src/main/java/wicket/Session.java
Author: jcompagner
Date: Sat Oct 14 18:46:45 2006
New Revision: 464094
URL: http://svn.apache.org/viewvc?view=rev&rev=464094
Log:
transient field must be re tested!
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=464094&r1=464093&r2=464094
==============================================================================
--- incubator/wicket/trunk/wicket/src/main/java/wicket/Session.java (original)
+++ incubator/wicket/trunk/wicket/src/main/java/wicket/Session.java Sat Oct 14 18:46:45 2006
@@ -169,7 +169,7 @@
private FeedbackMessages feedbackMessages = new FeedbackMessages(
new CopyOnWriteArrayList<FeedbackMessage>());
- private transient Map<PageMap, Thread> pageMapsUsedInRequest = new HashMap<PageMap, Thread>(3);
+ private transient Map<PageMap, Thread> pageMapsUsedInRequest;
/** cached id because you can't access the id after session unbound */
private String id = null;
@@ -456,6 +456,14 @@
pageMapName));
if (pageMap != null)
{
+ synchronized (usedPageMaps) // get a lock so be sure that only one is made
+ {
+ if(pageMapsUsedInRequest == null)
+ {
+ // TODO!! this is not synchronized.. it should be (on session?)
+ pageMapsUsedInRequest = new HashMap<PageMap, Thread>(3);
+ }
+ }
synchronized (pageMapsUsedInRequest)
{
long startTime = System.currentTimeMillis();
@@ -1088,19 +1096,22 @@
*/
final void requestDetached()
{
- synchronized (pageMapsUsedInRequest)
+ if(pageMapsUsedInRequest != null)
{
- Thread t = Thread.currentThread();
- Iterator<Map.Entry<PageMap, Thread>> it = pageMapsUsedInRequest.entrySet().iterator();
- while (it.hasNext())
+ synchronized (pageMapsUsedInRequest)
{
- Entry<PageMap, Thread> entry = it.next();
- if (entry.getValue() == t)
+ Thread t = Thread.currentThread();
+ Iterator<Map.Entry<PageMap, Thread>> it = pageMapsUsedInRequest.entrySet().iterator();
+ while (it.hasNext())
{
- it.remove();
+ Entry<PageMap, Thread> entry = it.next();
+ if (entry.getValue() == t)
+ {
+ it.remove();
+ }
}
+ pageMapsUsedInRequest.notifyAll();
}
- pageMapsUsedInRequest.notifyAll();
}
}