diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java index e2023ccf01..5c7635b02f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 the original author or authors. + * Copyright 2016-2024 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. @@ -95,11 +95,9 @@ public final class StandardIntegrationFlowContext implements IntegrationFlowCont private IntegrationFlowRegistration register(StandardIntegrationFlowRegistrationBuilder builder) { IntegrationFlow integrationFlow = builder.integrationFlow; String flowId = builder.id; - Lock registerBeanLock = null; + this.registerFlowsLock.lock(); try { if (flowId == null) { - registerBeanLock = this.registerFlowsLock; - registerBeanLock.lock(); flowId = generateBeanName(integrationFlow, null); builder.id(flowId); } @@ -112,9 +110,7 @@ public final class StandardIntegrationFlowContext implements IntegrationFlowCont integrationFlow = registerFlowBean(integrationFlow, flowId, builder.source); } finally { - if (registerBeanLock != null) { - registerBeanLock.unlock(); - } + this.registerFlowsLock.unlock(); } builder.integrationFlow = integrationFlow; @@ -209,7 +205,6 @@ public final class StandardIntegrationFlowContext implements IntegrationFlowCont for (String beanName : dependentBeans) { removeDependantBeans(beanName); this.beanDefinitionRegistry.removeBeanDefinition(beanName); - // TODO until https://jira.spring.io/browse/SPR-16837 String[] aliases = this.beanDefinitionRegistry.getAliases(beanName); for (String alias : aliases) { this.beanDefinitionRegistry.removeAlias(alias);