1
1
/*
2
- * Copyright 2002-2015 the original author or authors.
2
+ * Copyright 2002-2016 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -136,7 +136,7 @@ protected void registerAllEndpoints() {
136
136
this .endpointRegistry .registerListenerContainer (
137
137
descriptor .endpoint , resolveContainerFactory (descriptor ));
138
138
}
139
- startImmediately = true ; // trigger immediate startup
139
+ this . startImmediately = true ; // trigger immediate startup
140
140
}
141
141
}
142
142
@@ -149,9 +149,10 @@ else if (this.containerFactory != null) {
149
149
}
150
150
else if (this .containerFactoryBeanName != null ) {
151
151
Assert .state (this .beanFactory != null , "BeanFactory must be set to obtain container factory by bean name" );
152
+ // Consider changing this if live change of the factory is required...
152
153
this .containerFactory = this .beanFactory .getBean (
153
154
this .containerFactoryBeanName , JmsListenerContainerFactory .class );
154
- return this .containerFactory ; // Consider changing this if live change of the factory is required
155
+ return this .containerFactory ;
155
156
}
156
157
else {
157
158
throw new IllegalStateException ("Could not resolve the " +
@@ -169,10 +170,12 @@ else if (this.containerFactoryBeanName != null) {
169
170
public void registerEndpoint (JmsListenerEndpoint endpoint , JmsListenerContainerFactory <?> factory ) {
170
171
Assert .notNull (endpoint , "Endpoint must be set" );
171
172
Assert .hasText (endpoint .getId (), "Endpoint id must be set" );
173
+
172
174
// Factory may be null, we defer the resolution right before actually creating the container
173
175
JmsListenerEndpointDescriptor descriptor = new JmsListenerEndpointDescriptor (endpoint , factory );
176
+
174
177
synchronized (this .mutex ) {
175
- if (startImmediately ) { // Register and start immediately
178
+ if (this . startImmediately ) { // register and start immediately
176
179
this .endpointRegistry .registerListenerContainer (descriptor .endpoint ,
177
180
resolveContainerFactory (descriptor ), true );
178
181
}
0 commit comments