Follow on to r980418
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 29 Jul 2010 12:28:40 +0000 (12:28 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 29 Jul 2010 12:28:40 +0000 (12:28 +0000)
Need to move registration with context to ManagerBase too

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@980424 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/ha/session/DeltaManager.java
java/org/apache/catalina/session/ManagerBase.java
java/org/apache/catalina/session/PersistentManagerBase.java
java/org/apache/catalina/session/StandardManager.java

index 087197f..e6b8eb7 100644 (file)
@@ -442,31 +442,6 @@ public class DeltaManager extends ClusterManagerBase{
         this.cluster = cluster;
     }
 
-    /**
-     * Set the Container with which this Manager has been associated. If it is a
-     * Context (the usual case), listen for changes to the session timeout
-     * property.
-     * 
-     * @param container
-     *            The associated Container
-     */
-    @Override
-    public void setContainer(Container container) {
-        // De-register from the old Container (if any)
-        if ((this.container != null) && (this.container instanceof Context))
-            ((Context) this.container).removePropertyChangeListener(this);
-
-        // Default processing provided by our superclass
-        super.setContainer(container);
-
-        // Register with the new Container (if any)
-        if ((this.container != null) && (this.container instanceof Context)) {
-            setMaxInactiveInterval(((Context) this.container).getSessionTimeout() * 60);
-            ((Context) this.container).addPropertyChangeListener(this);
-        }
-
-    }
-    
     // --------------------------------------------------------- Public Methods
 
     /**
index c3d20c2..78299af 100644 (file)
@@ -308,9 +308,21 @@ public abstract class ManagerBase extends LifecycleMBeanBase
      */
     public void setContainer(Container container) {
 
+        // De-register from the old Container (if any)
+        if ((this.container != null) && (this.container instanceof Context))
+            ((Context) this.container).removePropertyChangeListener(this);
+
         Container oldContainer = this.container;
         this.container = container;
         support.firePropertyChange("container", oldContainer, this.container);
+
+        // Register with the new Container (if any)
+        if ((this.container != null) && (this.container instanceof Context)) {
+            setMaxInactiveInterval
+                ( ((Context) this.container).getSessionTimeout()*60 );
+            ((Context) this.container).addPropertyChangeListener(this);
+        }
+
     }
 
 
index 832ddf2..14d1300 100644 (file)
@@ -25,8 +25,6 @@ import java.security.PrivilegedExceptionAction;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.catalina.Container;
-import org.apache.catalina.Context;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
@@ -299,34 +297,6 @@ public abstract class PersistentManagerBase extends ManagerBase {
 
 
     /**
-     * Set the Container with which this Manager has been associated. If it is a
-     * Context (the usual case), listen for changes to the session timeout
-     * property.
-     * 
-     * @param container
-     *            The associated Container
-     */
-    @Override
-    public void setContainer(Container container) {
-
-        // De-register from the old Container (if any)
-        if ((this.container != null) && (this.container instanceof Context))
-            ((Context) this.container).removePropertyChangeListener(this);
-
-        // Default processing provided by our superclass
-        super.setContainer(container);
-
-        // Register with the new Container (if any)
-        if ((this.container != null) && (this.container instanceof Context)) {
-            setMaxInactiveInterval
-                ( ((Context) this.container).getSessionTimeout()*60 );
-            ((Context) this.container).addPropertyChangeListener(this);
-        }
-
-    }
-
-
-    /**
      * Return descriptive information about this Manager implementation and
      * the corresponding version number, in the format
      * <code>&lt;description&gt;/&lt;version&gt;</code>.
index 567dfb7..b479e7f 100644 (file)
@@ -18,7 +18,6 @@
 
 package org.apache.catalina.session;
 
-import java.beans.PropertyChangeEvent;
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.io.File;
@@ -34,7 +33,6 @@ import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Iterator;
 import javax.servlet.ServletContext;
-import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
@@ -125,33 +123,6 @@ public class StandardManager extends ManagerBase {
 
 
     /**
-     * Set the Container with which this Manager has been associated.  If
-     * it is a Context (the usual case), listen for changes to the session
-     * timeout property.
-     *
-     * @param container The associated Container
-     */
-    @Override
-    public void setContainer(Container container) {
-
-        // De-register from the old Container (if any)
-        if ((this.container != null) && (this.container instanceof Context))
-            ((Context) this.container).removePropertyChangeListener(this);
-
-        // Default processing provided by our superclass
-        super.setContainer(container);
-
-        // Register with the new Container (if any)
-        if ((this.container != null) && (this.container instanceof Context)) {
-            setMaxInactiveInterval
-                ( ((Context) this.container).getSessionTimeout()*60 );
-            ((Context) this.container).addPropertyChangeListener(this);
-        }
-
-    }
-
-
-    /**
      * Return descriptive information about this Manager implementation and
      * the corresponding version number, in the format
      * <code>&lt;description&gt;/&lt;version&gt;</code>.