Only creating a DefaultEndpointPoller if the source is not a Subscribable channel.

This commit is contained in:
Mark Fisher
2008-07-15 19:04:25 +00:00
parent 1b98a3e647
commit cb7fe54f17
2 changed files with 5 additions and 9 deletions

View File

@@ -85,12 +85,12 @@ public class DefaultMessageBus implements MessageBus, ApplicationContextAware, A
private final Set<EndpointTrigger> endpointTriggers = new CopyOnWriteArraySet<EndpointTrigger>();
private volatile Schedule defaultPollerSchedule = new PollingSchedule(0);
private final List<Lifecycle> lifecycleEndpoints = new CopyOnWriteArrayList<Lifecycle>();
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);
}

View File

@@ -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) {