You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2026/09/18 15:14:05 UTC

(tomcat) branch 10.1.x updated: No need for volatile here.

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

markt-asf 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 22f43571ce No need for volatile here.
22f43571ce is described below

commit 22f43571ce22311acddb43ea32bb754e94f0e21e
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Sep 18 16:13:28 2026 +0100

    No need for volatile here.
    
    Thanks to Fatima Qaisar
---
 java/org/apache/tomcat/websocket/server/WsWriteTimeout.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/server/WsWriteTimeout.java b/java/org/apache/tomcat/websocket/server/WsWriteTimeout.java
index 15d9949e1e..e1f80b845b 100644
--- a/java/org/apache/tomcat/websocket/server/WsWriteTimeout.java
+++ b/java/org/apache/tomcat/websocket/server/WsWriteTimeout.java
@@ -40,12 +40,12 @@ public class WsWriteTimeout implements BackgroundProcess {
     private final ReentrantLock backgroundProcessLock = new ReentrantLock();
     private int count = 0;
 
-    private volatile int backgroundProcessCount = 0;
+    private int backgroundProcessCount = 0;
     private volatile int processPeriod = 1;
 
     @Override
     public void backgroundProcess() {
-        // This method gets called once a second.
+        // This method gets called once a second. Always by the WsBackgroundThread instance so no concurrency concerns.
         backgroundProcessCount++;
 
         if (backgroundProcessCount >= processPeriod) {


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