You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/02/06 22:34:12 UTC

svn commit: r907311 - /tomcat/trunk/java/org/apache/catalina/startup/Catalina.java

Author: markt
Date: Sat Feb  6 21:34:12 2010
New Revision: 907311

URL: http://svn.apache.org/viewvc?rev=907311&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48678
StandardService already defines server. Having two in the type hierarchy just causes confusion

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/Catalina.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java?rev=907311&r1=907310&r2=907311&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/Catalina.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Catalina.java Sat Feb  6 21:34:12 2010
@@ -32,7 +32,6 @@
 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 @@
 
 
     /**
-     * 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 @@
     }
 
 
-    /**
-     * 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 @@
             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 @@
 
         // 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 @@
         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 @@
     @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 @@
         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 @@
         }
 
         // 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 void await() {
 
-        server.await();
+        getServer().await();
 
     }
 
@@ -672,7 +654,7 @@
         @Override
         public void run() {
 
-            if (server != null) {
+            if (getServer() != null) {
                 Catalina.this.stop();
             }
             



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org