|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2015 the original author or authors. |
|
|
|
* Copyright 2002-2016 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -136,7 +136,7 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ |
|
|
|
this.endpointRegistry.registerListenerContainer( |
|
|
|
this.endpointRegistry.registerListenerContainer( |
|
|
|
descriptor.endpoint, resolveContainerFactory(descriptor)); |
|
|
|
descriptor.endpoint, resolveContainerFactory(descriptor)); |
|
|
|
} |
|
|
|
} |
|
|
|
startImmediately = true; // trigger immediate startup
|
|
|
|
this.startImmediately = true; // trigger immediate startup
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -149,9 +149,10 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ |
|
|
|
} |
|
|
|
} |
|
|
|
else if (this.containerFactoryBeanName != null) { |
|
|
|
else if (this.containerFactoryBeanName != null) { |
|
|
|
Assert.state(this.beanFactory != null, "BeanFactory must be set to obtain container factory by bean name"); |
|
|
|
Assert.state(this.beanFactory != null, "BeanFactory must be set to obtain container factory by bean name"); |
|
|
|
|
|
|
|
// Consider changing this if live change of the factory is required...
|
|
|
|
this.containerFactory = this.beanFactory.getBean( |
|
|
|
this.containerFactory = this.beanFactory.getBean( |
|
|
|
this.containerFactoryBeanName, JmsListenerContainerFactory.class); |
|
|
|
this.containerFactoryBeanName, JmsListenerContainerFactory.class); |
|
|
|
return this.containerFactory; // Consider changing this if live change of the factory is required
|
|
|
|
return this.containerFactory; |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
throw new IllegalStateException("Could not resolve the " + |
|
|
|
throw new IllegalStateException("Could not resolve the " + |
|
|
|
@ -169,10 +170,12 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ |
|
|
|
public void registerEndpoint(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory) { |
|
|
|
public void registerEndpoint(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory) { |
|
|
|
Assert.notNull(endpoint, "Endpoint must be set"); |
|
|
|
Assert.notNull(endpoint, "Endpoint must be set"); |
|
|
|
Assert.hasText(endpoint.getId(), "Endpoint id must be set"); |
|
|
|
Assert.hasText(endpoint.getId(), "Endpoint id must be set"); |
|
|
|
|
|
|
|
|
|
|
|
// Factory may be null, we defer the resolution right before actually creating the container
|
|
|
|
// Factory may be null, we defer the resolution right before actually creating the container
|
|
|
|
JmsListenerEndpointDescriptor descriptor = new JmsListenerEndpointDescriptor(endpoint, factory); |
|
|
|
JmsListenerEndpointDescriptor descriptor = new JmsListenerEndpointDescriptor(endpoint, factory); |
|
|
|
|
|
|
|
|
|
|
|
synchronized (this.mutex) { |
|
|
|
synchronized (this.mutex) { |
|
|
|
if (startImmediately) { // Register and start immediately
|
|
|
|
if (this.startImmediately) { // register and start immediately
|
|
|
|
this.endpointRegistry.registerListenerContainer(descriptor.endpoint, |
|
|
|
this.endpointRegistry.registerListenerContainer(descriptor.endpoint, |
|
|
|
resolveContainerFactory(descriptor), true); |
|
|
|
resolveContainerFactory(descriptor), true); |
|
|
|
} |
|
|
|
} |
|
|
|
|