[jboss-cvs] JBoss Messaging SVN: r6754 - in trunk: src/bin and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 13 04:10:21 EDT 2009


Author: ataylor
Date: 2009-05-13 04:10:21 -0400 (Wed, 13 May 2009)
New Revision: 6754

Added:
   trunk/src/bin/stop.bat
   trunk/src/bin/stop.sh
Modified:
   trunk/build-messaging.xml
   trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
   trunk/src/main/org/jboss/messaging/integration/bootstrap/JBMBootstrapServer.java
Log:
added stop scripts

Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml	2009-05-13 07:57:26 UTC (rev 6753)
+++ trunk/build-messaging.xml	2009-05-13 08:10:21 UTC (rev 6754)
@@ -821,8 +821,12 @@
          <fileset dir="${src.bin.dir}">
             <include name="run.sh"/>
             <include name="run.bat"/>
+            <include name="stop.sh"/>
+            <include name="stop.bat"/>
          </fileset>
       </copy>
+      <chmod file="${build.distro.bin.dir}/run.sh" perm="ugo+rx"/>
+      <chmod file="${build.distro.bin.dir}/stop.sh" perm="ugo+rx"/>
       <copy todir="${build.distro.bin.dir}">
          <fileset dir="${native.bin.dir}">
             <include name="*.so"/>

Added: trunk/src/bin/stop.bat
===================================================================

Added: trunk/src/bin/stop.sh
===================================================================
--- trunk/src/bin/stop.sh	                        (rev 0)
+++ trunk/src/bin/stop.sh	2009-05-13 08:10:21 UTC (rev 6754)
@@ -0,0 +1 @@
+touch KILL_ME;
\ No newline at end of file

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2009-05-13 07:57:26 UTC (rev 6753)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2009-05-13 08:10:21 UTC (rev 6754)
@@ -356,6 +356,7 @@
       initialised = false;
       uuid = null;
       nodeID = null;
+      log.info("JBoss Messaging Server version " + getVersion().getFullVersion() + " stopped");
    }
 
    // MessagingServer implementation

Modified: trunk/src/main/org/jboss/messaging/integration/bootstrap/JBMBootstrapServer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/bootstrap/JBMBootstrapServer.java	2009-05-13 07:57:26 UTC (rev 6753)
+++ trunk/src/main/org/jboss/messaging/integration/bootstrap/JBMBootstrapServer.java	2009-05-13 08:10:21 UTC (rev 6754)
@@ -36,6 +36,8 @@
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Properties;
+import java.util.Timer;
+import java.util.TimerTask;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 /**
@@ -69,13 +71,41 @@
     */
    public static void main(final String[] args) throws Exception
    {
-      log.info("Starting JBoss Messaging server");
+      log.info("Starting JBoss Messaging Server");
 
-      JBMBootstrapServer bootstrap = new JBMBootstrapServer(args);
+      final JBMBootstrapServer bootstrap = new JBMBootstrapServer(args);
       
       bootstrap.run();
+      String dirName = System.getProperty("jbm.bootsrap.bin.dir", ".");
+      final File file = new File(dirName + "/KILL_ME");
+      if(file.exists())
+      {
+         file.delete();
+      }
+      final Timer timer = new Timer("JBM Server Shutdown Timer", true);
+      timer.scheduleAtFixedRate(new TimerTask()
+      {
+         @Override
+         public void run()
+         {
+            if(file.exists())
+            {
+               try
+               {
+                  log.info("Stopping JBoss Messaging Server");
+                  bootstrap.shutDown();
+                  timer.cancel();
+               }
+               finally
+               {
+                  Runtime.getRuntime().exit(0);
+               }
+            }
+         }
+      }, 500, 500);
    }
 
+
    public void run()
    {
       try
@@ -213,7 +243,7 @@
       ListIterator<KernelDeployment> iterator = deployments.listIterator(deployments.size());
       while (iterator.hasPrevious())
       {
-         KernelDeployment deployment = (KernelDeployment) iterator.previous();
+         KernelDeployment deployment = iterator.previous();
          try {undeploy(deployment);} catch (Throwable ignored){}
       }
    }




More information about the jboss-cvs-commits mailing list