Support disabling the broker auto startup XBean behavior.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1402651 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2012-10-26 20:28:38 +00:00
parent dc4ceb47e8
commit 4a294080e3
2 changed files with 19 additions and 2 deletions

View File

@ -41,6 +41,7 @@ import org.springframework.core.io.Resource;
*/
public class XBeanBrokerFactory implements BrokerFactoryHandler {
private static final transient Logger LOG = LoggerFactory.getLogger(XBeanBrokerFactory.class);
private static final ThreadLocal<Boolean> START_DEFAULT = new ThreadLocal<Boolean>();
static {
PropertyEditorManager.registerEditor(URI.class, URIEditor.class);
@ -56,7 +57,6 @@ public class XBeanBrokerFactory implements BrokerFactoryHandler {
}
public BrokerService createBroker(URI config) throws Exception {
String uri = config.getSchemeSpecificPart();
if (uri.lastIndexOf('?') != -1) {
IntrospectionSupport.setProperties(this, URISupport.parseQuery(uri));
@ -110,4 +110,20 @@ public class XBeanBrokerFactory implements BrokerFactoryHandler {
throw errorToLog;
}
}
public static void setStartDefault(boolean startDefault) {
START_DEFAULT.set(startDefault);
}
public static void resetStartDefault() {
START_DEFAULT.remove();
}
public static boolean getStartDefault() {
Boolean value = START_DEFAULT.get();
if( value==null ) {
return true;
}
return value.booleanValue();
}
}

View File

@ -41,9 +41,10 @@ import org.springframework.beans.CachedIntrospectionResults;
*/
public class XBeanBrokerService extends BrokerService {
private boolean start = true;
private boolean start;
public XBeanBrokerService() {
start = XBeanBrokerFactory.getStartDefault();
}
/**