GH-2081 Add synchronization on channel resolution method in StreamBridge
This should mitigate race condition when StreamBridge is used in an async way Resolves #2081
This commit is contained in:
@@ -181,8 +181,8 @@ public final class StreamBridge implements SmartInitializingSingleton {
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "deprecation" })
|
||||
SubscribableChannel resolveDestination(String destinationName, ProducerProperties producerProperties) {
|
||||
@SuppressWarnings("unchecked")
|
||||
synchronized SubscribableChannel resolveDestination(String destinationName, ProducerProperties producerProperties) {
|
||||
SubscribableChannel messageChannel = this.channelCache.get(destinationName);
|
||||
if (messageChannel == null && this.applicationContext.containsBean(destinationName)) {
|
||||
messageChannel = this.applicationContext.getBean(destinationName, SubscribableChannel.class);
|
||||
|
||||
Reference in New Issue
Block a user