This patch allows the creation of startup scripts and configuration 
files that permit you to (a) start JBoss from directories other than 
$JBOSSHOME/bin or (b) boot JBoss from within another Java application.

The only problematic piece seems to be InstantDB which does not like 
this at all (it hangs during object pool allocation with no errors -- a 
URL problem that I can't config my way out of). My workaround for the 
moment is not to use it.

stewart

Index: src/main/org/jboss/Main.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/Main.java,v
retrieving revision 1.38
diff -u -r1.38 Main.java
--- src/main/org/jboss/Main.java        2001/06/22 18:59:51     1.38
+++ src/main/org/jboss/Main.java        2001/07/11 20:10:44
@@ -122,6 +122,7 @@
    public Main(String confName, String patchDir)
    {
          Date startTime = new Date();
+         String jbhome = System.getProperty("jboss.home");
 
       try
       {
@@ -142,7 +143,7 @@
          final MBeanServer server = MBeanServerFactory.createMBeanServer();
 
          // Add configuration directory to MLet
-         URL confDirectory = new File("../conf/"+confName).getCanonicalFile().toURL();
+         URL confDirectory = new 
+File(jbhome+"/conf/"+confName).getCanonicalFile().toURL();
          URL[] urls = {confDirectory};
          // Add any patch jars to the MLet so they are seen ahead of the JBoss jars
          if( patchDir != null )
Index: src/main/org/jboss/util/Shutdown.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/Shutdown.java,v
retrieving revision 1.5
diff -u -r1.5 Shutdown.java
--- src/main/org/jboss/util/Shutdown.java       2001/06/22 23:11:15     1.5
+++ src/main/org/jboss/util/Shutdown.java       2001/07/11 20:10:44
@@ -32,6 +32,18 @@
 
    /** Instance logger. */
    private final Category log = Category.getInstance(Shutdown.class);
+   private final Thread shutdownHook = new Thread()
+        {
+               public void run()
+               {
+                  System.out.println("Shutting down");
+                  
+                  // Make sure all services are down properly
+                  shutdownServices();
+                  
+                  System.out.println("Shutdown complete");
+               }
+        };
    
    List mbeans = new ArrayList();
    MBeanServer server;
@@ -39,7 +51,8 @@
    // Public  -------------------------------------------------------
    public void shutdown()
    {
-      System.exit(0); // This will execute the shutdown hook
+         shutdownHook.start();
+//      System.exit(0); // This will execute the shutdown hook
    }
    
    // MBeanRegistration implementation ------------------------------
@@ -50,18 +63,7 @@
       this.server = server;
       try
       {
-         Runtime.getRuntime().addShutdownHook(new Thread()
-         {
-            public void run()
-            {
-               System.out.println("Shutting down");
-               
-               // Make sure all services are down properly
-               shutdownServices();
-               
-               System.out.println("Shutdown complete");
-            }
-         });
+         Runtime.getRuntime().addShutdownHook(shutdownHook);
          log.info("Shutdown hook added");
       } catch (Throwable e)
       {

Reply via email to