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

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

commit e7604b9f63c86a9e88bc569bd19d4f57739c6768
Author: Mark Thomas <[email protected]>
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 61f52b6be1..cb83257b26 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to