This is an automated email from the ASF dual-hosted git repository. rmaucher pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 95cf31e1e9871e2bcef1346d4a403cbcd85b03ac Author: opencode <[email protected]> AuthorDate: Wed Sep 30 22:39:18 2026 +0200 Keep existing proxy connections in TcpSender.init when the proxy list has not changed since the heartbeat runs init on every periodic event and closing connections there defeated the keep-alive design --- java/org/apache/catalina/ha/backend/TcpSender.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/java/org/apache/catalina/ha/backend/TcpSender.java b/java/org/apache/catalina/ha/backend/TcpSender.java index 203541e7ed..4098279516 100644 --- a/java/org/apache/catalina/ha/backend/TcpSender.java +++ b/java/org/apache/catalina/ha/backend/TcpSender.java @@ -80,9 +80,23 @@ public class TcpSender implements Sender { */ protected BufferedWriter[] connectionWriters = null; + /** + * The proxy list that the current connections were established for. + */ + protected String proxyList = null; + @Override public void init(HeartbeatListener config) throws Exception { + String newProxyList = config.getProxyList(); + if (connections != null && newProxyList != null && newProxyList.equals(proxyList)) { + // The proxy list has not changed since the previous init, so the + // existing connections can be kept. The init is called for every + // heartbeat and closing the connections here would defeat the + // keep-alive design. + this.config = config; + return; + } // Close any existing connections from a previous init if (connections != null) { for (int i = 0; i < connections.length; i++) { @@ -111,6 +125,7 @@ public class TcpSender implements Sender { connections = new Socket[proxies.length]; connectionReaders = new BufferedReader[proxies.length]; connectionWriters = new BufferedWriter[proxies.length]; + proxyList = newProxyList; } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
