This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new c6fe49a680 Sync to produce accurate stats
c6fe49a680 is described below

commit c6fe49a6801a4e3430901eed1dacafcf60ae41b0
Author: remm <r...@apache.org>
AuthorDate: Wed Sep 27 10:50:03 2023 +0200

    Sync to produce accurate stats
    
    The interceptor is explicitly configured by the user, so ...
    Found by coverity.
---
 .../org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java   | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
index e4fb76c293..84759bbc77 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
@@ -407,14 +407,13 @@ public class SlowQueryReport extends AbstractQueryReport  
{
             this.query = query;
         }
 
-        public void prepare(long invocationTime) {
+        public synchronized void prepare(long invocationTime) {
             prepareCount++;
             prepareTime+=invocationTime;
 
         }
 
-        public void add(long invocationTime, long now) {
-            //not thread safe, but don't sacrifice performance for this kind 
of stuff
+        public synchronized void add(long invocationTime, long now) {
             maxInvocationTime = Math.max(invocationTime, maxInvocationTime);
             if (maxInvocationTime == invocationTime) {
                 maxInvocationDate = now;
@@ -428,7 +427,7 @@ public class SlowQueryReport extends AbstractQueryReport  {
             lastInvocation = now;
         }
 
-        public void failure(long invocationTime, long now) {
+        public synchronized void failure(long invocationTime, long now) {
             add(invocationTime,now);
             failures++;
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to