You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2012/01/16 19:55:42 UTC
svn commit: r1232111 -
/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java
Author: fmeschbe
Date: Mon Jan 16 18:55:42 2012
New Revision: 1232111
URL: http://svn.apache.org/viewvc?rev=1232111&view=rev
Log:
SLING-2370 Ensure atomic request counter handling
Modified:
sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java
Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java?rev=1232111&r1=1232110&r2=1232111&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java (original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java Mon Jan 16 18:55:42 2012
@@ -28,6 +28,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
@@ -61,13 +62,13 @@ public class SlingHttpServletResponseImp
* each time this component is restarted (system start, bundle start,
* reconfiguration), the request counter restarts at zero.
*/
- private static int requestCounter = 0;
+ private static AtomicLong requestCounter = new AtomicLong();
// TODO: more content related headers, namely Content-Language should
// probably be supported
// the request counter
- private int requestId;
+ private long requestId;
// the system time in ms when the request entered the system, this is
// the time this instance was created
@@ -101,7 +102,7 @@ public class SlingHttpServletResponseImp
super(response);
this.requestData = requestData;
- this.requestId = requestCounter++;
+ this.requestId = requestCounter.getAndIncrement();
this.requestStart = System.currentTimeMillis();
}
@@ -288,7 +289,7 @@ public class SlingHttpServletResponseImp
// ---------- Retrieving response information ------------------------------
- public int getRequestId() {
+ public long getRequestId() {
return this.requestId;
}