Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48678
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 6 Feb 2010 21:34:12 +0000 (21:34 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 6 Feb 2010 21:34:12 +0000 (21:34 +0000)
StandardService already defines server. Having two in the type hierarchy just causes confusion

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@907311 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/startup/Catalina.java

index 73c7177..762d761 100644 (file)
@@ -32,7 +32,6 @@ import java.util.List;
 import org.apache.catalina.Container;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleException;
-import org.apache.catalina.Server;
 import org.apache.catalina.core.StandardServer;
 import org.apache.tomcat.util.digester.Digester;
 import org.apache.tomcat.util.digester.Rule;
@@ -81,12 +80,6 @@ public class Catalina extends Embedded {
 
 
     /**
-     * The server component we are starting or stopping
-     */
-    protected Server server = null;
-
-
-    /**
      * Are we starting a new server?
      */
     protected boolean starting = false;
@@ -150,18 +143,6 @@ public class Catalina extends Embedded {
     }
 
 
-    /**
-     * Set the server instance we are configuring.
-     *
-     * @param server The new server
-     */
-    @Override
-    public void setServer(Server server) {
-
-        this.server = server;
-
-    }
-
     // ----------------------------------------------------------- Main Program
 
     /**
@@ -398,7 +379,7 @@ public class Catalina extends Embedded {
             arguments(arguments);
         }
 
-        if( server == null ) {
+        if( getServer() == null ) {
             // Create and execute our Digester
             Digester digester = createStopDigester();
             digester.setClassLoader(Thread.currentThread().getContextClassLoader());
@@ -419,10 +400,11 @@ public class Catalina extends Embedded {
 
         // Stop the existing server
         try {
-            if (server.getPort()>0) { 
-                Socket socket = new Socket(server.getAddress(), server.getPort());
+            if (getServer().getPort()>0) { 
+                Socket socket = new Socket(getServer().getAddress(),
+                        getServer().getPort());
                 OutputStream stream = socket.getOutputStream();
-                String shutdown = server.getShutdown();
+                String shutdown = getServer().getShutdown();
                 for (int i = 0; i < shutdown.length(); i++)
                     stream.write(shutdown.charAt(i));
                 stream.flush();
@@ -516,9 +498,9 @@ public class Catalina extends Embedded {
         initStreams();
 
         // Start the new server
-        if (server instanceof Lifecycle) {
+        if (getServer() instanceof Lifecycle) {
             try {
-                server.initialize();
+                getServer().initialize();
             } catch (LifecycleException e) {
                 if (Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE"))
                     throw new java.lang.Error(e);
@@ -563,11 +545,11 @@ public class Catalina extends Embedded {
     @Override
     public void start() {
 
-        if (server == null) {
+        if (getServer() == null) {
             load();
         }
 
-        if (server == null) {
+        if (getServer() == null) {
             log.fatal("Cannot start server. Server instance is not configured.");
             return;
         }
@@ -575,9 +557,9 @@ public class Catalina extends Embedded {
         long t1 = System.nanoTime();
         
         // Start the new server
-        if (server instanceof Lifecycle) {
+        if (getServer() instanceof Lifecycle) {
             try {
-                ((Lifecycle) server).start();
+                ((Lifecycle) getServer()).start();
             } catch (LifecycleException e) {
                 log.error("Catalina.start: ", e);
             }
@@ -626,9 +608,9 @@ public class Catalina extends Embedded {
         }
 
         // Shut down the server
-        if (server instanceof Lifecycle) {
+        if (getServer() instanceof Lifecycle) {
             try {
-                ((Lifecycle) server).stop();
+                ((Lifecycle) getServer()).stop();
             } catch (LifecycleException e) {
                 log.error("Catalina.stop", e);
             }
@@ -642,7 +624,7 @@ public class Catalina extends Embedded {
      */
     public void await() {
 
-        server.await();
+        getServer().await();
 
     }
 
@@ -672,7 +654,7 @@ public class Catalina extends Embedded {
         @Override
         public void run() {
 
-            if (server != null) {
+            if (getServer() != null) {
                 Catalina.this.stop();
             }