Author: markt
Date: Fri Nov 20 20:28:51 2015
New Revision: 1715417

URL: http://svn.apache.org/viewvc?rev=1715417&view=rev
Log:
Correctly notify the MapperListener associated with a Service if the
Engine for that Service is changed.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/core/StandardService.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties?rev=1715417&r1=1715416&r2=1715417&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties Fri Nov 
20 20:28:51 2015
@@ -194,6 +194,10 @@ standardService.connector.initFailed=Fai
 standardService.connector.pauseFailed=Failed to pause connector [{0}]
 standardService.connector.startFailed=Failed to start connector [{0}]
 standardService.connector.stopFailed=Failed to stop connector [{0}]
+standardService.engine.startFailed=Failed to start associated Engine
+standardService.engine.stopFailed=Failed to stop associated Engine
+standardService.mapperListener.startFailed=Failed to start associated 
MapperListener
+standardService.mapperListener.stopFailed=Failed to stop associated 
MapperListener
 standardService.start.name=Starting service {0}
 standardService.stop.name=Stopping service {0}
 standardWrapper.allocate=Error allocating a servlet instance

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardService.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardService.java?rev=1715417&r1=1715416&r2=1715417&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardService.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardService.java Fri Nov 20 
20:28:51 2015
@@ -129,18 +129,31 @@ public class StandardService extends Lif
         if (this.engine != null) {
             this.engine.setService(this);
         }
-        if (getState().isAvailable() && (this.engine != null)) {
+        if (getState().isAvailable()) {
+            if (this.engine != null) {
+                try {
+                    this.engine.start();
+                } catch (LifecycleException e) {
+                    
log.warn(sm.getString("standardService.engine.startFailed"), e);
+                }
+            }
+            // Restart MapperListener to pick up new engine.
             try {
-                this.engine.start();
+                mapperListener.stop();
             } catch (LifecycleException e) {
-                // Ignore
+                
log.warn(sm.getString("standardService.mapperListener.stopFailed"), e);
             }
-        }
-        if (getState().isAvailable() && (oldEngine != null)) {
             try {
-                oldEngine.stop();
+                mapperListener.start();
             } catch (LifecycleException e) {
-                // Ignore
+                
log.warn(sm.getString("standardService.mapperListener.startFailed"), e);
+            }
+            if (oldEngine != null) {
+                try {
+                    oldEngine.stop();
+                } catch (LifecycleException e) {
+                    
log.warn(sm.getString("standardService.engine.stopFailed"), e);
+                }
             }
         }
 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1715417&r1=1715416&r2=1715417&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Nov 20 20:28:51 2015
@@ -70,6 +70,10 @@
         <bug>58629</bug>: Allow an embedded Tomcat instance to start when the
         <code>Service</code> has no <code>Engine</code> configured. (markt)
       </fix>
+      <fix>
+        Correctly notify the MapperListener associated with a Service if the
+        Engine for that Service is changed. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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

Reply via email to