From 39b70b2fc43f8d9c65c6a98f8a3cf0822aec8d6a Mon Sep 17 00:00:00 2001 From: markt Date: Sun, 2 May 2010 18:01:58 +0000 Subject: [PATCH] Add init() and destroy() support git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@940281 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/startup/Tomcat.java | 32 ++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/startup/Tomcat.java b/java/org/apache/catalina/startup/Tomcat.java index 785b8602f..c3d0e40d6 100644 --- a/java/org/apache/catalina/startup/Tomcat.java +++ b/java/org/apache/catalina/startup/Tomcat.java @@ -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(). -- 2.11.0