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 2008/04/10 16:06:23 UTC

svn commit: r646810 - /wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/RequestLogger.java

Author: jcompagner
Date: Thu Apr 10 07:06:13 2008
New Revision: 646810

URL: http://svn.apache.org/viewvc?rev=646810&view=rev
Log:
maybe this fixes martijns issue, but i dont think so..
But it is much faster the syncing..

Modified:
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/RequestLogger.java

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/RequestLogger.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/RequestLogger.java?rev=646810&r1=646809&r2=646810&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/RequestLogger.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/RequestLogger.java Thu Apr 10 07:06:13 2008
@@ -24,6 +24,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.wicket.Application;
 import org.apache.wicket.IClusterable;
@@ -93,7 +94,7 @@
 
 	private final ThreadLocal<RequestData> currentRequest = new ThreadLocal<RequestData>();
 
-	private int active;
+	private AtomicInteger active;
 
 	/**
 	 * Construct.
@@ -141,7 +142,7 @@
 	 */
 	public int getCurrentActiveRequestCount()
 	{
-		return active;
+		return active.get();
 	}
 
 	/**
@@ -188,10 +189,7 @@
 		{
 			rd = new RequestData();
 			currentRequest.set(rd);
-			synchronized (this)
-			{
-				active++;
-			}
+			active.incrementAndGet();
 		}
 		return rd;
 	}
@@ -204,12 +202,9 @@
 		RequestData rd = currentRequest.get();
 		if (rd != null)
 		{
-			synchronized (this)
+			if (active.get() > 0)
 			{
-				if (active > 0)
-				{
-					rd.setActiveRequest(active--);
-				}
+				rd.setActiveRequest(active.decrementAndGet());
 			}
 			Session session = Session.get();
 			String sessionId = session.getId();