activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1402651 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean: XBeanBrokerFactory.java XBeanBrokerService.java
Date Fri, 26 Oct 2012 20:28:38 GMT
Author: chirino
Date: Fri Oct 26 20:28:38 2012
New Revision: 1402651

URL: http://svn.apache.org/viewvc?rev=1402651&view=rev
Log:
Support disabling the broker auto startup XBean behavior.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java?rev=1402651&r1=1402650&r2=1402651&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java
Fri Oct 26 20:28:38 2012
@@ -41,6 +41,7 @@ import org.springframework.core.io.Resou
  */
 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 implemen
     }
 
     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 implemen
             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();
+    }
+
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java?rev=1402651&r1=1402650&r2=1402651&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
Fri Oct 26 20:28:38 2012
@@ -41,9 +41,10 @@ import org.springframework.beans.CachedI
  */
 public class XBeanBrokerService extends BrokerService {
 
-    private boolean start = true;
+    private boolean start;
 
     public XBeanBrokerService() {
+        start = XBeanBrokerFactory.getStartDefault();
     }
 
     /**



Mime
View raw message