From: fhanik Date: Mon, 20 Oct 2008 22:36:56 +0000 (+0000) Subject: if replicated context starts without clustering enabled, then the map is not swapped... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3e77ab34e9f27045364784f468a77b390edf347b;p=tomcat7.0 if replicated context starts without clustering enabled, then the map is not swapped, and we get class cast exception upon shutdown git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@706433 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/ha/context/ReplicatedContext.java b/java/org/apache/catalina/ha/context/ReplicatedContext.java index 402ea41ac..50d4edc5f 100644 --- a/java/org/apache/catalina/ha/context/ReplicatedContext.java +++ b/java/org/apache/catalina/ha/context/ReplicatedContext.java @@ -54,6 +54,7 @@ public class ReplicatedContext extends StandardContext implements LifecycleListe startComplete = true; } + @Override public synchronized void start() throws LifecycleException { if ( this.started ) return; super.addLifecycleListener(this); @@ -74,13 +75,14 @@ public class ReplicatedContext extends StandardContext implements LifecycleListe } } + @Override public synchronized void stop() throws LifecycleException { - ReplicatedMap map = (ReplicatedMap)((ReplApplContext)this.context).getAttributeMap(); - if ( map!=null ) { - map.breakdown(); - } if ( !this.started ) return; + AbstractMap map = (AbstractMap)((ReplApplContext)this.context).getAttributeMap(); + if ( map!=null && map instanceof ReplicatedMap) { + ((ReplicatedMap)map).breakdown(); + } try { super.lifecycle.removeLifecycleListener(this); } catch ( Exception x ){