This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new b549e27e45 Sync to produce accurate stats b549e27e45 is described below commit b549e27e4585625320f4e5ba1982a5f1be6b77e9 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