if replicated context starts without clustering enabled, then the map is not swapped...
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 20 Oct 2008 22:36:56 +0000 (22:36 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 20 Oct 2008 22:36:56 +0000 (22:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@706433 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/ha/context/ReplicatedContext.java

index 402ea41..50d4edc 100644 (file)
@@ -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 ){