This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new d600476f16 Use LongAdder for processing time - prompted by Coverity
scan report
d600476f16 is described below
commit d600476f16527d36c5e31847572b82e87b88e187
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Aug 14 17:48:39 2023 +0100
Use LongAdder for processing time - prompted by Coverity scan report
---
java/org/apache/catalina/core/StandardWrapperValve.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/java/org/apache/catalina/core/StandardWrapperValve.java
b/java/org/apache/catalina/core/StandardWrapperValve.java
index 35a2acba84..70b1cb86e7 100644
--- a/java/org/apache/catalina/core/StandardWrapperValve.java
+++ b/java/org/apache/catalina/core/StandardWrapperValve.java
@@ -63,7 +63,7 @@ final class StandardWrapperValve extends ValveBase {
// Some JMX statistics. This valve is associated with a StandardWrapper.
// We expose the StandardWrapper as JMX ( j2eeType=Servlet ). The fields
// are here for performance.
- private volatile long processingTime;
+ private final LongAdder processingTime = new LongAdder();
private volatile long maxTime;
private volatile long minTime = Long.MAX_VALUE;
private final AtomicInteger requestCount = new AtomicInteger(0);
@@ -237,7 +237,7 @@ final class StandardWrapperValve extends ValveBase {
long t2 = System.currentTimeMillis();
long time = t2 - t1;
- processingTime += time;
+ processingTime.add(time);
if (time > maxTime) {
maxTime = time;
}
@@ -278,7 +278,7 @@ final class StandardWrapperValve extends ValveBase {
}
public long getProcessingTime() {
- return processingTime;
+ return processingTime.sum();
}
public long getMaxTime() {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]