You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2004/06/10 03:09:03 UTC
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup Embedded.java
luehe 2004/06/09 18:09:03
Modified: catalina/src/share/org/apache/catalina/core
StandardService.java
catalina/src/share/org/apache/catalina/startup Embedded.java
Log:
Fixed Bugzilla 29472 ("Embedded overrides add/remove Connector, but not findConnectors")
Revision Changes Path
1.12 +23 -21 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardService.java
Index: StandardService.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardService.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- StandardService.java 27 Feb 2004 14:58:42 -0000 1.11
+++ StandardService.java 10 Jun 2004 01:09:03 -0000 1.12
@@ -57,18 +57,6 @@
/**
- * The set of Connectors associated with this Service.
- */
- private Connector connectors[] = new Connector[0];
-
-
- /**
- * The Container associated with this Service.
- */
- private Container container = null;
-
-
- /**
* The debugging detail level for this component.
*/
private int debug = 0;
@@ -82,12 +70,6 @@
/**
- * Has this component been initialized?
- */
- private boolean initialized = false;
-
-
- /**
* The name of this service.
*/
private String name = null;
@@ -122,6 +104,26 @@
protected PropertyChangeSupport support = new PropertyChangeSupport(this);
+ /**
+ * The set of Connectors associated with this Service.
+ */
+ protected Connector connectors[] = new Connector[0];
+
+
+ /**
+ * The Container associated with this Service. (In the case of the
+ * org.apache.catalina.startup.Embedded subclass, this holds the most
+ * recently added Engine.)
+ */
+ protected Container container = null;
+
+
+ /**
+ * Has this component been initialized?
+ */
+ protected boolean initialized = false;
+
+
// ------------------------------------------------------------- Properties
@@ -285,7 +287,7 @@
try {
connector.initialize();
} catch (LifecycleException e) {
- e.printStackTrace(System.err);
+ log.error("Connector.initialize", e);
}
}
@@ -293,7 +295,7 @@
try {
((Lifecycle) connector).start();
} catch (LifecycleException e) {
- ;
+ log.error("Connector.start", e);
}
}
@@ -360,7 +362,7 @@
try {
((Lifecycle) connectors[j]).stop();
} catch (LifecycleException e) {
- ;
+ log.error("Connector.stop", e);
}
}
connectors[j].setContainer(null);
1.14 +8 -77 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Embedded.java
Index: Embedded.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Embedded.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Embedded.java 27 Feb 2004 14:58:48 -0000 1.13
+++ Embedded.java 10 Jun 2004 01:09:03 -0000 1.14
@@ -145,12 +145,6 @@
/**
- * The set of Connectors that have been deployed in this server.
- */
- protected Connector connectors[] = new Connector[0];
-
-
- /**
* The debugging detail level for this component.
*/
protected int debug = 0;
@@ -397,28 +391,11 @@
throw new IllegalStateException
(sm.getString("embedded.noEngines"));
- // Configure this Connector as needed
- connector.setContainer(engines[engines.length - 1]);
-
- // Add this Connector to our set of defined Connectors
- Connector results[] = new Connector[connectors.length + 1];
- for (int i = 0; i < connectors.length; i++)
- results[i] = connectors[i];
- results[connectors.length] = connector;
- connectors = results;
-
- // Start this Connector if necessary
- if (started) {
- try {
- connector.initialize();
- if (connector instanceof Lifecycle) {
- ((Lifecycle) connector).start();
- }
- } catch (LifecycleException e) {
- log.error("Connector.start", e);
- }
- }
-
+ /*
+ * Add the connector. This will set the connector's container to the
+ * most recently added Engine
+ */
+ super.addConnector(connector);
}
@@ -448,6 +425,7 @@
}
}
+ this.container = engine;
}
@@ -704,53 +682,6 @@
/**
- * Remove the specified Connector from the set of defined Connectors.
- *
- * @param connector The Connector to be removed
- */
- public synchronized void removeConnector(Connector connector) {
-
- if( log.isDebugEnabled() ) {
- log.debug("Removing connector (" + connector.getInfo() + ")");
- }
-
- // Is the specified Connector actually defined?
- int j = -1;
- for (int i = 0; i < connectors.length; i++) {
- if (connector == connectors[i]) {
- j = i;
- break;
- }
- }
- if (j < 0)
- return;
-
- // Stop this Connector if necessary
- if (connector instanceof Lifecycle) {
- if( log.isDebugEnabled() )
- log.debug(" Stopping this Connector");
- try {
- ((Lifecycle) connector).stop();
- } catch (LifecycleException e) {
- log.error("Connector.stop", e);
- }
- }
-
- // Remove this Connector from our set of defined Connectors
- if( log.isDebugEnabled() )
- log.debug(" Removing this Connector");
- int k = 0;
- Connector results[] = new Connector[connectors.length - 1];
- for (int i = 0; i < connectors.length; i++) {
- if (i != j)
- results[k++] = connectors[i];
- }
- connectors = results;
-
- }
-
-
- /**
* Remove the specified Context from the set of defined Contexts for its
* associated Host. If this is the last Context for this Host, the Host
* will also be removed.
@@ -968,7 +899,7 @@
(sm.getString("embedded.alreadyStarted"));
lifecycle.fireLifecycleEvent(START_EVENT, null);
started = true;
-
+ initialized = true;
// Start our defined Engines first
for (int i = 0; i < engines.length; i++) {
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org