Support the creation and registration of message listener containers in
a lazy manner, that is after the container initialization has completed.
Such support brought an interesting brainstorming of the thread safety
if JmsListenerEndpointRegistrar and JmsListenerEndpointRegistry so those
have also been revisited as part of this commit.
Issue: SPR-12774
@ -50,6 +51,10 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
@@ -50,6 +51,10 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
@ -113,6 +118,10 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
@@ -113,6 +118,10 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
@ -122,8 +131,12 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
@@ -122,8 +131,12 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
@ -157,7 +170,16 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
@@ -157,7 +170,16 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
Assert.notNull(endpoint,"Endpoint 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
@ -57,7 +57,7 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
@@ -57,7 +57,7 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
@ -86,21 +86,43 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
@@ -86,21 +86,43 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
@ -163,9 +185,7 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
@@ -163,9 +185,7 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
@ -195,6 +215,17 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
@@ -195,6 +215,17 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
@ -115,6 +120,22 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@@ -115,6 +120,22 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
assertTrue("Should have been started "+container,container.isStarted());
context.close();// Close and stop the listeners
assertTrue("Should have been stopped "+container,container.isStopped());
}
@EnableJms
@Configuration
staticclassEnableJmsSampleConfig{
@ -240,4 +261,13 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@@ -240,4 +261,13 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {