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 af25a68262 Fix resetting cross context sessions
af25a68262 is described below
commit af25a682627b7e1d8a680895fbd1301f1afc720a
Author: remm <[email protected]>
AuthorDate: Wed Mar 19 19:57:08 2025 +0100
Fix resetting cross context sessions
Apparent logic error in the loop.
---
java/org/apache/catalina/ha/tcp/ReplicationValve.java | 12 +++---------
webapps/docs/changelog.xml | 4 ++++
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/java/org/apache/catalina/ha/tcp/ReplicationValve.java
b/java/org/apache/catalina/ha/tcp/ReplicationValve.java
index 5e2257f74c..1872c95bf3 100644
--- a/java/org/apache/catalina/ha/tcp/ReplicationValve.java
+++ b/java/org/apache/catalina/ha/tcp/ReplicationValve.java
@@ -18,7 +18,6 @@ package org.apache.catalina.ha.tcp;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.LongAdder;
@@ -421,15 +420,10 @@ public class ReplicationValve extends ValveBase
implements ClusterValve {
}
if (isCrossContext) {
List<DeltaSession> sessions = crossContextSessions.get();
- if (sessions != null && sessions.size() > 0) {
- Iterator<DeltaSession> iter = sessions.iterator();
- for (; iter.hasNext();) {
- Session session = iter.next();
+ if (sessions != null) {
+ for (DeltaSession session : sessions) {
resetDeltaRequest(session);
- if (session instanceof DeltaSession) {
- ((DeltaSession)
contextSession).setPrimarySession(true);
- }
-
+ session.setPrimarySession(true);
}
}
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index dce8c06ce8..547dc01c3e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -223,6 +223,10 @@
<subsection name="Cluster">
<changelog>
<!-- Entries for backport and removal before 12.0.0-M1 below this line
-->
+ <fix>
+ Fix resetting cross context sessions in the
+ <code>ReplicationValve</code>. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Web applications">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]