You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by yinghe0101 <yi...@yahoo.com> on 2008/12/03 20:08:29 UTC

WebConsole start

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-tp20819457p20819457.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: WebConsole start

Posted by Dejan Bosanac <de...@ttmsolutions.com>.
Maybe a better approach would be to start a Jetty with JMX enabled, so
you can use JConsole to manage it?

If you take this route, however, note that much better approach is to
get Jetty bean by type (not name).

I guess the ActiveMQ OSGi architecture would tackle this nicely?

Cheers

-- 
Dejan Bosanac


http://www.ttmsolutions.com - get a free ActiveMQ user guide

ActiveMQ in Action - http://www.manning.com/snyder/
Scripting in Java - http://www.scriptinginjava.net



yinghe0101 wrote:
> 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
>>
>>     
>
>   


Re: WebConsole start

Posted by yinghe0101 <yi...@yahoo.com>.
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.