It is using xbean config to start broker and jetty etc.

currently BrokerService jmx stop will stop the broker but embeded jetty
server will keep running so the java process does not quit without a Ctrl+C.
and activemq-admin stop has the same effect also activemq-admin stop simply
calls terminateJVM, eats the exception and just quit( see the
activemq-console code).

I plan to improve the stopping process and will post on jira when ready.
Here is some code snippet which will stop jetty when stop() is called:

--- src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
(revision 672024)
+++ src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java     (working
copy)
@@ -17,6 +17,7 @@
 package org.apache.activemq.xbean;
 
 import org.apache.activemq.broker.BrokerService;
+import org.mortbay.jetty.xbean.JettyFactoryBean;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.DisposableBean;
 import org.springframework.beans.factory.InitializingBean;
@@ -46,7 +47,30 @@
 
     public XBeanBrokerService() {
     }
-
+    
+    /**
+     * This will cause the java process to quit when calling BrokerService
stop()
+     */
+    public void stopAdditionalProcess()throws Exception{
+       if(applicationContext!=null){
+               Object
jettyServerObj=applicationContext.getBean("org.mortbay.jetty.xbean.JettyFactoryBean#0");
+               if(jettyServerObj!=null){
+                       JettyFactoryBean 
jettyServer=(JettyFactoryBean)jettyServerObj;
+                       jettyServer.stop();
+               }
+       }
+    }
+    
+    public void stop() throws Exception {
+       super.stop();
+       stopAdditionalProcess();
+    }
+    



yinghe0101 wrote:
> 
> hi, 
> Does anyone know how the embedded jetty for admin console starts when I do
> activemq-admin start?
> 
> the activemq-admin stop simply calls jmx's terminateJVM to stop the broker
> which does System.exit(0), if I use jconsole jmx to do stop(), it will
> stop the broker but not kill jetty admin console and it will be still
> listening on its port. I want the broker stop() to stop jetty first then
> shutdown all its connector, is that possible to do?
> 
> best,
> ying
> 

-- 
View this message in context: 
http://www.nabble.com/WebConsole-start-tp20819457p20834586.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to