From b4a56e60b81bcf64260a0e53325d9cd7cbc9d90a Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 3 Jan 2022 13:05:32 -0500 Subject: [PATCH] Fix AbstractCF around sender property The `senders` list was introduced starting version `5.4` --- .../tcp/connection/AbstractConnectionFactory.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java index 3fb324bff4..c1140c26ec 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java @@ -552,7 +552,9 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport TcpConnection connection = iterator.next().getValue(); connection.close(); iterator.remove(); - getSenders().forEach(sender -> sender.removeDeadConnection(connection)); + if (this.sender != null) { + this.sender.removeDeadConnection(connection); + } } } synchronized (this.lifecycleMonitor) { @@ -843,8 +845,10 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport TcpConnectionSupport connection = entry.getValue(); if (!connection.isOpen()) { iterator.remove(); - getSenders().forEach(sender -> sender.removeDeadConnection(connection)); - + if (this.sender != null) { + this.sender.removeDeadConnection(connection); + } + if (logger.isDebugEnabled()) { logger.debug(getComponentName() + ": Removed closed connection: " + connection.getConnectionId()); @@ -926,7 +930,9 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport try { connection.close(); closed = true; - getSenders().forEach(sender -> sender.removeDeadConnection(connection)); + if (this.sender != null) { + this.sender.removeDeadConnection(connection); + } } catch (Exception e) { if (logger.isDebugEnabled()) {