You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2006/09/13 23:29:12 UTC

svn commit: r443131 - in /geronimo/server/trunk: configs/activemq-broker/src/plan/plan.xml modules/geronimo-activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java

Author: jdillon
Date: Wed Sep 13 14:29:11 2006
New Revision: 443131

URL: http://svn.apache.org/viewvc?view=rev&rev=443131
Log:
(GERONIMO-2364) Disable the brokers shutdown hook, let G stop it

Modified:
    geronimo/server/trunk/configs/activemq-broker/src/plan/plan.xml
    geronimo/server/trunk/modules/geronimo-activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java

Modified: geronimo/server/trunk/configs/activemq-broker/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/activemq-broker/src/plan/plan.xml?view=diff&rev=443131&r1=443130&r2=443131
==============================================================================
--- geronimo/server/trunk/configs/activemq-broker/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/activemq-broker/src/plan/plan.xml Wed Sep 13 14:29:11 2006
@@ -28,6 +28,7 @@
         <attribute name="brokerURI">xbean:file:/path/to/activemq.xml</attribute>
         -->
         <attribute name="brokerName">possibly-unique-broker</attribute>
+        <attribute name="useShutdownHook">false</attribute>
         <attribute name="dataDirectory">activemq-data</attribute>
         <reference name="dataSource">
             <name>SystemDatasource</name>
@@ -35,9 +36,6 @@
         <reference name="manager">
             <name>ActiveMQManager</name>
         </reference>
-        <dependency>
-            <name>SystemProperties</name>
-        </dependency>
         <reference name="serverInfo">
             <name>ServerInfo</name>
         </reference>
@@ -68,12 +66,6 @@
         <reference name="brokerService">
             <name>ActiveMQ</name>
         </reference>
-    </gbean>
-
-    <gbean name="SystemProperties" class="org.apache.geronimo.system.properties.SystemProperties">
-        <attribute name="systemProperties">
-            activemq.broker.disable-clean-shutdown=true
-        </attribute>
     </gbean>
 
 </module>

Modified: geronimo/server/trunk/modules/geronimo-activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java?view=diff&rev=443131&r1=443130&r2=443131
==============================================================================
--- geronimo/server/trunk/modules/geronimo-activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java (original)
+++ geronimo/server/trunk/modules/geronimo-activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java Wed Sep 13 14:29:11 2006
@@ -14,6 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
+
 package org.apache.activemq.gbean;
 
 import java.net.URI;
@@ -33,7 +34,6 @@
 import org.apache.geronimo.management.geronimo.NetworkConnector;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 
-
 /**
  * Default implementation of the ActiveMQ Message Server
  *
@@ -41,7 +41,7 @@
  */
 public class BrokerServiceGBeanImpl implements GBeanLifecycle, BrokerServiceGBean {
 
-    private Log log = LogFactory.getLog(getClass().getName());
+    private Log log = LogFactory.getLog(getClass());
 
     private String brokerName;
     private String brokerUri;
@@ -52,6 +52,7 @@
     private ClassLoader classLoader;
     private String objectName;
     private JMSManager manager;
+    private boolean useShutdownHook;
 
     public BrokerServiceGBeanImpl() {
     }
@@ -61,23 +62,24 @@
     }
 
     public synchronized void doStart() throws Exception {
-        	ClassLoader old = Thread.currentThread().getContextClassLoader();
-        	Thread.currentThread().setContextClassLoader(getClassLoader());
-        	try {
-    	        if (brokerService == null) {
-    	            brokerService = createContainer();
-    	        }
-                DefaultPersistenceAdapterFactory persistenceFactory = (DefaultPersistenceAdapterFactory) brokerService.getPersistenceFactory();
-                persistenceFactory.setDataDirectory(serverInfo.resolvePath(dataDirectory));
-                persistenceFactory.setDataSource((DataSource) dataSource.$getResource());
-                brokerService.start();
-        	} finally {
-            	Thread.currentThread().setContextClassLoader(old);
-        	}
+        ClassLoader old = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(getClassLoader());
+        try {
+            if (brokerService == null) {
+                brokerService = createContainer();
+            }
+            brokerService.setUseShutdownHook(isUseShutdownHook());
+            DefaultPersistenceAdapterFactory persistenceFactory = (DefaultPersistenceAdapterFactory) brokerService.getPersistenceFactory();
+            persistenceFactory.setDataDirectory(serverInfo.resolvePath(dataDirectory));
+            persistenceFactory.setDataSource((DataSource) dataSource.$getResource());
+            brokerService.start();
+        } finally {
+            Thread.currentThread().setContextClassLoader(old);
+        }
     }
 
     protected BrokerService createContainer() throws Exception {
-        if( brokerUri!=null ) {
+        if (brokerUri != null) {
             BrokerService answer = BrokerFactory.createBroker(new URI(brokerUri));
             brokerName = answer.getBrokerName();
             return answer;
@@ -103,7 +105,7 @@
             try {
                 temp.stop();
             } catch (Exception e) {
-                log.info("Caught while closing due to failure: " + e, e);
+                log.warn("Caught while closing due to failure: " + e, e);
             }
         }
     }
@@ -116,6 +118,7 @@
         infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
         infoBuilder.addAttribute("brokerName", String.class, true);
         infoBuilder.addAttribute("brokerUri", String.class, true);
+        infoBuilder.addAttribute("useShutdownHook", Boolean.TYPE, true);
         infoBuilder.addAttribute("dataDirectory", String.class, true);
         infoBuilder.addReference("dataSource", ConnectionFactorySource.class);
         infoBuilder.addAttribute("objectName", String.class, false);
@@ -218,5 +221,12 @@
     public void setClassLoader(ClassLoader classLoader) {
         this.classLoader = classLoader;
     }
-	
+
+    public boolean isUseShutdownHook() {
+        return useShutdownHook;
+    }
+
+    public void setUseShutdownHook(final boolean useShutdownHook) {
+        this.useShutdownHook = useShutdownHook;
+    }
 }