[jboss-cvs] JBossAS SVN: r84185 - projects/server-manager/trunk/src/main/java/org/jboss/jbossas/servermanager.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 13 11:42:20 EST 2009


Author: rachmatowicz at jboss.com
Date: 2009-02-13 11:42:20 -0500 (Fri, 13 Feb 2009)
New Revision: 84185

Modified:
   projects/server-manager/trunk/src/main/java/org/jboss/jbossas/servermanager/ServerController.java
Log:
Reinstate delay after Process.destroy() to permit destroyed processes to shutdown and make this issue more visible through comments. Also move the delay so that it only occurs if a process needs to be destroyed.

Modified: projects/server-manager/trunk/src/main/java/org/jboss/jbossas/servermanager/ServerController.java
===================================================================
--- projects/server-manager/trunk/src/main/java/org/jboss/jbossas/servermanager/ServerController.java	2009-02-13 16:12:47 UTC (rev 84184)
+++ projects/server-manager/trunk/src/main/java/org/jboss/jbossas/servermanager/ServerController.java	2009-02-13 16:42:20 UTC (rev 84185)
@@ -47,6 +47,10 @@
 
    private static final String MAIN = "org.jboss.Main"; 
    
+   // delay (in ms) to guarantee that a destroyed process cannot respond with true
+   // to ServerController.isServerStarted()
+   private static final long PROCESS_DESTROY_DELAY = 45 * 1000 ;
+   
    private ServerController()
    {
    }
@@ -415,11 +419,19 @@
             e.printStackTrace();
          }
 
+         System.err.println("Failed to shutdown server \"" + server.getName()
+                 + "\"" + (shutdownException == null ? " before timeout." : ".")
+                    + " Destroying the process.");
+
          // destroy process and print an error messsage
          process.destroy();
-         System.err.println("Failed to shutdown server \"" + server.getName()
-            + "\"" + (shutdownException == null ? " before timeout." : ".")
-               + " Destroying the process.");
+         
+         // although the process has been destroyed, we need to wait for it to shutdown
+         try {
+       	  Thread.sleep(PROCESS_DESTROY_DELAY) ;
+         }
+         catch(InterruptedException e) {  
+         }
       }
 
       closeAllStreams(process);
@@ -428,7 +440,7 @@
 
   	  // this affects the value of Server.isStopped()
       server.setProcess(null);
-
+      
       if (!cleanShutdown)
       {
          throw (ServerShutdownException) new ServerShutdownException(




More information about the jboss-cvs-commits mailing list