Author: remy.maucherat(a)jboss.com
Date: 2009-04-01 20:48:01 -0400 (Wed, 01 Apr 2009)
New Revision: 977
Modified:
trunk/java/org/apache/catalina/core/StandardWrapperValve.java
trunk/webapps/docs/sysprops.xml
Log:
- Ok, so 5 (now 6) volatile were used to track rather useless stats, and I had forgotten
about it.
Modified: trunk/java/org/apache/catalina/core/StandardWrapperValve.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-04-01 17:42:19 UTC
(rev 976)
+++ trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-04-02 00:48:01 UTC
(rev 977)
@@ -28,6 +28,7 @@
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
+import javax.servlet.AsyncContext;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.UnavailableException;
@@ -56,6 +57,12 @@
final class StandardWrapperValve
extends ValveBase {
+
+ protected static final boolean SERVLET_STATS =
+ Globals.STRICT_SERVLET_COMPLIANCE
+ ||
Boolean.valueOf(System.getProperty("org.apache.catalina.core.StandardWrapperValve.SERVLET_STATS",
"false")).booleanValue();
+
+
// ----------------------------------------------------- Instance Variables
@@ -65,6 +72,7 @@
private volatile long processingTime;
private volatile long maxTime;
private volatile long minTime = Long.MAX_VALUE;
+ private volatile int eventCount;
private volatile int requestCount;
private volatile int errorCount;
@@ -97,8 +105,11 @@
boolean unavailable = false;
Throwable throwable = null;
// This should be a Request attribute...
- long t1=System.currentTimeMillis();
- requestCount++;
+ long t1 = 0;
+ if (SERVLET_STATS) {
+ t1 = System.currentTimeMillis();
+ requestCount++;
+ }
StandardWrapper wrapper = (StandardWrapper) getContainer();
Servlet servlet = null;
Context context = (Context) wrapper.getParent();
@@ -332,12 +343,17 @@
exception(request, response, e);
}
}
- long t2=System.currentTimeMillis();
- long time=t2-t1;
- processingTime += time;
- if( time > maxTime) maxTime=time;
- if( time < minTime) minTime=time;
+ if (SERVLET_STATS) {
+ long time = System.currentTimeMillis() - t1;
+ processingTime += time;
+ if (time > maxTime) {
+ maxTime = time;
+ }
+ if (time < minTime) {
+ minTime = time;
+ }
+ }
}
@@ -361,8 +377,11 @@
// Initialize local variables we may need
Throwable throwable = null;
// This should be a Request attribute...
- long t1=System.currentTimeMillis();
- // FIXME: Add a flag to count the total amount of events processed ?
requestCount++;
+ long t1 = 0;
+ if (SERVLET_STATS) {
+ t1 = System.currentTimeMillis();
+ eventCount++;
+ }
StandardWrapper wrapper = (StandardWrapper) getContainer();
Servlet servlet = null;
Context context = (Context) wrapper.getParent();
@@ -413,6 +432,7 @@
* - If timeout, invoke listeners
* - If error ?
*/
+ AsyncContext asyncContext = request.getAsyncContext();
// Get the current (unchanged) filter chain for this request
ApplicationFilterChain filterChain =
@@ -513,13 +533,17 @@
}
}
- long t2=System.currentTimeMillis();
+ if (SERVLET_STATS) {
+ long time = System.currentTimeMillis() - t1;
+ processingTime += time;
+ if (time > maxTime) {
+ maxTime = time;
+ }
+ if (time < minTime) {
+ minTime = time;
+ }
+ }
- long time=t2-t1;
- processingTime += time;
- if( time > maxTime) maxTime=time;
- if( time < minTime) minTime=time;
-
}
@@ -584,6 +608,14 @@
this.errorCount = errorCount;
}
+ public int getEventCount() {
+ return eventCount;
+ }
+
+ public void setEventCount(int eventCount) {
+ this.eventCount = eventCount;
+ }
+
// Don't register in JMX
public ObjectName createObjectName(String domain, ObjectName parent)
Modified: trunk/webapps/docs/sysprops.xml
===================================================================
--- trunk/webapps/docs/sysprops.xml 2009-04-01 17:42:19 UTC (rev 976)
+++ trunk/webapps/docs/sysprops.xml 2009-04-02 00:48:01 UTC (rev 977)
@@ -99,6 +99,7 @@
<p>The size of the cache to use parsed and formatted date value. If not
specified, the default value of <code>1000</code> will be
used.</p>
</property>
+
<property name="org.apache.catalina.core.
StandardService.DELAY_CONNECTOR_STARTUP">
<p>If <code>true</code>, the connector startup will not be done
automatically. Useful
in embedded mode.</p>
@@ -304,6 +305,14 @@
</p>
</property>
+ <property name="org.apache.catalina.core.
StandardWrapperValve.SERVLET_STATS">
+ <p>If <code>true</code> or if
+ <code>org.apache.catalina.STRICT_SERVLET_COMPLIANCE</code> is
+ <code>true</code>, the wrapper will collect the JSR-77 statistics for
+ individual servlets. If not specified, the
+ default value of <code>false</code> will be used.</p>
+ </property>
+
<property
name="org.apache.catalina.session. StandardSession.ACTIVITY_CHECK">
<p>If this is <code>true</code> or if
Show replies by date