From 64489e1aaa9f5f78865a90282069e586ca363081 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 22 Feb 2021 12:57:30 -0500 Subject: [PATCH] GH-3497: `ReplyProducerCleaner`: check only MPs Fixes https://github.com/spring-projects/spring-integration/issues/3497 The `BaseIntegrationFlowDefinition.REFERENCED_REPLY_PRODUCERS` is filled up only with the `MessageProducer` instances. Therefore no reason to calculate a hash code for every single bean passed to the `ReplyProducerCleaner.requiresDestruction()` * Check for the `MessageProducer` instance before passing the bean to the `BaseIntegrationFlowDefinition.REFERENCED_REPLY_PRODUCERS.contains()` * Check for the `MessageProducer` in the `ReplyProducerCleaner.postProcessBeforeDestruction()`, too. It can be called independently of the `requiresDestruction()` and will calculate a hash code from the bean again for nothing **Cherry-pick to 5.4.x & 5.3.x** --- .../integration/dsl/BaseIntegrationFlowDefinition.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java index edf80a73c5..8407717f8f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 the original author or authors. + * Copyright 2019-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -3100,12 +3100,15 @@ public abstract class BaseIntegrationFlowDefinition