Skip to content

Commit

Permalink
Remove sync
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rmaucher committed Jan 18, 2024
1 parent 962cdc9 commit 160cc59
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions java/org/apache/catalina/ha/session/SessionMessageImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,13 @@ public String getSessionID() {

/**
* 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;
}
}

Expand Down

0 comments on commit 160cc59

Please sign in to comment.