activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1088717 - /activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
Date Mon, 04 Apr 2011 18:50:10 GMT
Author: chirino
Date: Mon Apr  4 18:50:10 2011
New Revision: 1088717

URL: http://svn.apache.org/viewvc?rev=1088717&view=rev
Log:
Add a shutdown hook which stops the broker.

Modified:
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala?rev=1088717&r1=1088716&r2=1088717&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
Mon Apr  4 18:50:10 2011
@@ -22,8 +22,8 @@ import org.apache.activemq.apollo.broker
 import org.fusesource.hawtdispatch._
 import org.apache.activemq.apollo.util.FileSupport._
 import org.apache.activemq.apollo.cli.Apollo
-import org.apache.activemq.apollo.util.{Log, LoggingReporter}
 import org.apache.felix.service.command.CommandSession
+import org.apache.activemq.apollo.util.{ServiceControl, Log, LoggingReporter}
 
 /**
  * The apollo run command
@@ -90,6 +90,12 @@ class Run extends Action {
       broker.tmp = tmp
       broker.start()
 
+      Runtime.getRuntime.addShutdownHook(new Thread(){
+        override def run: Unit = {
+          ServiceControl.stop(broker, "stopping broker")
+        }
+      })
+
       // wait forever...  broker will system exit.
       this.synchronized {
         this.wait



Mime
View raw message