Add init() and destroy() support
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 2 May 2010 18:01:58 +0000 (18:01 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 2 May 2010 18:01:58 +0000 (18:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@940281 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/startup/Tomcat.java

index 785b860..c3d0e40 100644 (file)
@@ -278,11 +278,22 @@ public class Tomcat {
         return sw;
     }
     
+
+    /**
+     * Initialise the server.
+     * 
+     * @throws LifecycleException
+     */
+    public void init() throws LifecycleException {
+        getServer();
+        getConnector();
+        server.init();
+    }
+    
     
     /**
-     * Initialize and start the server, assuming that the Server implementation
-     * implements {@link Lifecycle} (the standard implementation does). If it
-     * does not, the {@link Server} must be started directly.
+     * Start the server.
+     * 
      * @throws LifecycleException 
      */
     public void start() throws LifecycleException {
@@ -292,9 +303,8 @@ public class Tomcat {
     }
 
     /** 
-     * Stop the server, assuming that the Server implementation implements
-     * {@link Lifecycle} (the standard implementation does). If it does not, the
-     * {@link Server} must be stopped directly.
+     * Stop the server.
+     * 
      * @throws LifecycleException 
      */
     public void stop() throws LifecycleException {
@@ -303,6 +313,16 @@ public class Tomcat {
     }
 
 
+    /**
+     * Destroy the server. This object cannot be used once this method has been
+     * called.
+     */
+    public void destroy() throws LifecycleException {
+        getServer();
+        server.destroy();
+        // Could null out obejcts here
+    }
+    
     /** 
      * Add a user for the in-memory realm. All created apps use this 
      * by default, can be replaced using setRealm().