This is an automated email from the ASF dual-hosted git repository. remm 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 08b5a5cf71 Sync to produce accurate stats 08b5a5cf71 is described below commit 08b5a5cf7111d7420994b2dd642916ee3c6cf12b 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