From cb7fe54f1773dd10ca92fe4e6412468d9e38d884 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Tue, 15 Jul 2008 19:04:25 +0000 Subject: [PATCH] Only creating a DefaultEndpointPoller if the source is not a Subscribable channel. --- .../integration/bus/DefaultMessageBus.java | 10 ++-------- .../integration/endpoint/AbstractEndpoint.java | 4 +++- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/bus/DefaultMessageBus.java b/org.springframework.integration/src/main/java/org/springframework/integration/bus/DefaultMessageBus.java index 29f520e1c8..b4016cb828 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/bus/DefaultMessageBus.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/bus/DefaultMessageBus.java @@ -85,12 +85,12 @@ public class DefaultMessageBus implements MessageBus, ApplicationContextAware, A private final Set endpointTriggers = new CopyOnWriteArraySet(); + private volatile Schedule defaultPollerSchedule = new PollingSchedule(0); + private final List lifecycleEndpoints = new CopyOnWriteArrayList(); private final MessageBusInterceptorsList interceptors = new MessageBusInterceptorsList(); - private volatile Schedule defaultPollerSchedule = new PollingSchedule(0); - private volatile TaskScheduler taskScheduler; private volatile boolean configureAsyncEventMulticaster = false; @@ -340,12 +340,6 @@ public class DefaultMessageBus implements MessageBus, ApplicationContextAware, A Schedule schedule = endpoint.getSchedule(); EndpointTrigger trigger = new EndpointTrigger(schedule != null ? schedule : this.defaultPollerSchedule); trigger.addTarget(endpoint); - try { - endpoint.afterPropertiesSet(); - } - catch (Exception e) { - throw new ConfigurationException("failed to initialize endpoint '" + endpoint + "'", e); - } if (this.endpointTriggers.add(trigger)) { this.taskScheduler.schedule(trigger); } diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractEndpoint.java b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractEndpoint.java index 2e71e25cdf..e2886e9885 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractEndpoint.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractEndpoint.java @@ -32,6 +32,7 @@ import org.springframework.integration.message.MessageSource; import org.springframework.integration.message.MessageTarget; import org.springframework.integration.message.MessagingException; import org.springframework.integration.message.Poller; +import org.springframework.integration.message.Subscribable; import org.springframework.integration.message.TargetInvoker; import org.springframework.integration.message.selector.MessageSelector; import org.springframework.integration.scheduling.Schedule; @@ -198,7 +199,8 @@ public abstract class AbstractEndpoint implements MessageEndpoint, BeanNameAware } public void afterPropertiesSet() { - if (this.source != null && this.poller == null) { + if (this.poller == null && this.source != null + && !(this.source instanceof Subscribable)) { this.poller = new DefaultEndpointPoller(); } if (this.target == null) {