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 160cc59e7b Remove sync
160cc59e7b is described below

commit 160cc59e7b7644ba9346b7e72651dc21fc642920
Author: remm <r...@apache.org>
AuthorDate: Thu Jan 18 15:25:38 2024 +0100

    Remove sync
    
    This is always called after creating a message. This does not appear to
    be called again so I don't really see the need for timestampSet.
    If really needed, using an AtomicLong would probably be better (with
    compareAndSet(0, time)).
    Found by coverity.
---
 java/org/apache/catalina/ha/session/SessionMessageImpl.java | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/ha/session/SessionMessageImpl.java 
b/java/org/apache/catalina/ha/session/SessionMessageImpl.java
index 3c2884ae9a..bb54b5d666 100644
--- a/java/org/apache/catalina/ha/session/SessionMessageImpl.java
+++ b/java/org/apache/catalina/ha/session/SessionMessageImpl.java
@@ -112,14 +112,13 @@ public class SessionMessageImpl extends 
ClusterMessageBase implements SessionMes
 
     /**
      * set message send time but only the first setting works (one shot)
+     * @param time the timestamp
      */
     @Override
     public void setTimestamp(long time) {
-        synchronized (this) {
-            if (!timestampSet) {
-                serializationTimestamp = time;
-                timestampSet = true;
-            }
+        if (!timestampSet) {
+            serializationTimestamp = time;
+            timestampSet = true;
         }
     }
 


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

Reply via email to