You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by de...@apache.org on 2010/09/06 11:37:19 UTC

svn commit: r992984 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq: broker/BrokerService.java xbean/XBeanBrokerService.java

Author: dejanb
Date: Mon Sep  6 09:37:19 2010
New Revision: 992984

URL: http://svn.apache.org/viewvc?rev=992984&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2813 - BrokerService @PostConstruct

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.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/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=992984&r1=992983&r2=992984&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java Mon Sep  6 09:37:19 2010
@@ -450,12 +450,22 @@ public class BrokerService implements Se
     // Service interface
     // -------------------------------------------------------------------------
 
+    protected boolean shouldAutostart() {
+        return true;
+    }
+
     /**
      *
      * @throws Exception
      * @org. apache.xbean.InitMethod
      */
     @PostConstruct
+    public void autoStart() throws Exception {
+        if(shouldAutostart()) {
+            start();
+        }
+    }
+
     public void start() throws Exception {
         if (stopped.get() || !started.compareAndSet(false, true)) {
             // lets just ignore redundant start() calls

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=992984&r1=992983&r2=992984&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 Mon Sep  6 09:37:19 2010
@@ -56,11 +56,16 @@ public class XBeanBrokerService extends 
     @PostConstruct
     public void afterPropertiesSet() throws Exception {
         ensureSystemUsageHasStore();
-        if (start) {
+        if (shouldAutostart()) {
             start();
         }
     }
 
+    @Override
+    protected boolean shouldAutostart() {
+        return start;
+    }
+
     private void ensureSystemUsageHasStore() throws IOException {
         SystemUsage usage = getSystemUsage();
         if (usage.getStoreUsage().getStore() == null) {