From 9eb8c865620aa9f90c324f2642f5879bc0a3ed75 Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 5 Aug 2011 16:31:41 +0000 Subject: [PATCH] Prevent spurious log warnings on container stop if a child component has previously failed. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1154298 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/core/ContainerBase.java | 6 ++++-- java/org/apache/catalina/core/StandardContext.java | 6 ++++-- webapps/docs/changelog.xml | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/java/org/apache/catalina/core/ContainerBase.java b/java/org/apache/catalina/core/ContainerBase.java index 96fe008d1..4a736a656 100644 --- a/java/org/apache/catalina/core/ContainerBase.java +++ b/java/org/apache/catalina/core/ContainerBase.java @@ -1062,7 +1062,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase setState(LifecycleState.STOPPING); // Stop the Valves in our pipeline (including the basic), if any - if (pipeline instanceof Lifecycle) { + if (pipeline instanceof Lifecycle && + ((Lifecycle) pipeline).getState().isAvailable()) { ((Lifecycle) pipeline).stop(); } @@ -1082,7 +1083,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase if ((cluster != null) && (cluster instanceof Lifecycle)) { ((Lifecycle) cluster).stop(); } - if ((manager != null) && (manager instanceof Lifecycle)) { + if ((manager != null) && (manager instanceof Lifecycle) && + ((Lifecycle) manager).getState().isAvailable() ) { ((Lifecycle) manager).stop(); } if ((logger != null) && (logger instanceof Lifecycle)) { diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index 41f061706..b2e8cd3a4 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -5459,7 +5459,8 @@ public class StandardContext extends ContainerBase // Stop ContainerBackgroundProcessor thread threadStop(); - if (manager != null && manager instanceof Lifecycle) { + if (manager != null && manager instanceof Lifecycle && + ((Lifecycle) manager).getState().isAvailable()) { try { ((Lifecycle) manager).stop(); } catch (LifecycleException e) { @@ -5507,7 +5508,8 @@ public class StandardContext extends ContainerBase fireLifecycleEvent(Lifecycle.CONFIGURE_STOP_EVENT, null); // Stop the Valves in our pipeline (including the basic), if any - if (pipeline instanceof Lifecycle) { + if (pipeline instanceof Lifecycle && + ((Lifecycle) pipeline).getState().isAvailable()) { ((Lifecycle) pipeline).stop(); } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 1ced4935a..2e52495c9 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -138,6 +138,10 @@ 51614: Avoid calling store.load() and session.expire() twice in PersistentManager when expiring sessions. (kfujino) + + Prevent spurious log warnings on container stop if a child component has + previously failed. (markt) + -- 2.11.0