From a68cffba623f921b12fc2a419a2bff3364040e76 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Thu, 10 Jan 2008 13:35:01 +0000 Subject: [PATCH] Unified endpoint and targetAdapter maps into 'receivers' map. --- .../integration/bus/MessageBus.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/bus/MessageBus.java b/spring-integration-core/src/main/java/org/springframework/integration/bus/MessageBus.java index bb0de3d7ee..9211b00db4 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/bus/MessageBus.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/bus/MessageBus.java @@ -56,9 +56,7 @@ public class MessageBus implements ChannelRegistry, ApplicationContextAware, Lif private ChannelRegistry channelRegistry = new DefaultChannelRegistry(); - private Map> endpoints = new ConcurrentHashMap>(); - - private Map> targetAdapters = new ConcurrentHashMap>(); + private Map> receivers = new ConcurrentHashMap>(); private Map lifecycleComponents = new ConcurrentHashMap(); @@ -188,7 +186,7 @@ public class MessageBus implements ChannelRegistry, ApplicationContextAware, Lif Assert.notNull(name, "'name' must not be null"); Assert.notNull(endpoint, "'endpoint' must not be null"); endpoint.setName(name); - this.endpoints.put(name, endpoint); + this.receivers.put(name, endpoint); if (logger.isInfoEnabled()) { logger.info("registered endpoint '" + name + "'"); } @@ -227,7 +225,7 @@ public class MessageBus implements ChannelRegistry, ApplicationContextAware, Lif if (targetAdapter instanceof AbstractTargetAdapter) { AbstractTargetAdapter adapter = (AbstractTargetAdapter) targetAdapter; adapter.setName(name); - this.targetAdapters.put(name, targetAdapter); + this.receivers.put(name, targetAdapter); MessageChannel channel = adapter.getChannel(); ConsumerPolicy policy = adapter.getConsumerPolicy(); this.doActivate(channel, adapter, policy); @@ -241,12 +239,9 @@ public class MessageBus implements ChannelRegistry, ApplicationContextAware, Lif String channelName = subscription.getChannel(); String receiverName = subscription.getReceiver(); ConsumerPolicy policy = subscription.getPolicy(); - MessageReceiver receiver = this.endpoints.get(receiverName); + MessageReceiver receiver = this.receivers.get(receiverName); if (receiver == null) { - receiver = this.targetAdapters.get(receiverName); - if (receiver == null) { - throw new MessagingException("Cannot activate subscription, unknown receiver '" + receiverName + "'"); - } + throw new MessagingException("Cannot activate subscription, unknown receiver '" + receiverName + "'"); } MessageChannel channel = this.lookupChannel(channelName); if (channel == null) { @@ -308,10 +303,7 @@ public class MessageBus implements ChannelRegistry, ApplicationContextAware, Lif } public int getActiveCountForReceiver(String receiverName) { - MessageReceiver receiver = this.endpoints.get(receiverName); - if (receiver == null) { - receiver = this.targetAdapters.get(receiverName); - } + MessageReceiver receiver = this.receivers.get(receiverName); if (receiver != null) { MessageReceivingExecutor executor = this.receiverExecutors.get(receiver); if (executor != null) {