Author: markt
Date: Tue Jan 19 23:43:11 2016
New Revision: 1725652

URL: http://svn.apache.org/viewvc?rev=1725652&view=rev
Log:
Deprecate Manager.distributable and Manager.maxInactiveInterval since they 
exist in both the Context and the Manager and the Context values always take 
precedence.

Modified:
    tomcat/trunk/java/org/apache/catalina/Manager.java
    tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java
    tomcat/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java
    tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
    tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
    tomcat/trunk/test/org/apache/catalina/session/TestPersistentManager.java
    tomcat/trunk/webapps/docs/config/manager.xml

Modified: tomcat/trunk/java/org/apache/catalina/Manager.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Manager.java?rev=1725652&r1=1725651&r2=1725652&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Manager.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Manager.java Tue Jan 19 23:43:11 2016
@@ -66,7 +66,11 @@ public interface Manager {
      *
      * @return {@code true} if this manager is marked as distributable 
otherwise
      *         {@code false}
+     *
+     * @deprecated Ignored. {@link Context#getDistributable()} always takes
+     *             precedence. Will be removed in Tomcat 9.0.x.
      */
+    @Deprecated
     public boolean getDistributable();
 
 
@@ -76,7 +80,11 @@ public interface Manager {
      * manager must implement Serializable.
      *
      * @param distributable The new distributable flag
+     *
+     * @deprecated Ignored. {@link Context#getDistributable()} always takes
+     *             precedence. Will be removed in Tomcat 9.0.x.
      */
+    @Deprecated
     public void setDistributable(boolean distributable);
 
 
@@ -85,7 +93,11 @@ public interface Manager {
      * will be considered inactive.
      *
      * @return The default maximum inactive interval in seconds
+     *
+     * @deprecated Ignored. {@link Context#getSessionTimeout()} always takes
+     *             precedence. Will be removed in Tomcat 9.0.x.
      */
+    @Deprecated
     public int getMaxInactiveInterval();
 
 
@@ -94,7 +106,11 @@ public interface Manager {
      * for Sessions created by this Manager.
      *
      * @param interval The new default value
+     *
+     * @deprecated Ignored. {@link Context#getSessionTimeout()} always takes
+     *             precedence. Will be removed in Tomcat 9.0.x.
      */
+    @Deprecated
     public void setMaxInactiveInterval(int interval);
 
 

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java?rev=1725652&r1=1725651&r2=1725652&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java Tue Jan 
19 23:43:11 2016
@@ -187,11 +187,6 @@ public class BackupManager extends Clust
     }
 
     @Override
-    public void setDistributable(boolean dist) {
-        this.distributable = dist;
-    }
-
-    @Override
     public void setName(String name) {
         this.name = name;
     }

Modified: 
tomcat/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java?rev=1725652&r1=1725651&r2=1725652&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java 
Tue Jan 19 23:43:11 2016
@@ -189,7 +189,6 @@ public abstract class ClusterManagerBase
     protected void clone(ClusterManagerBase copy) {
         copy.setName("Clone-from-" + getName());
         copy.setMaxActiveSessions(getMaxActiveSessions());
-        copy.setMaxInactiveInterval(getMaxInactiveInterval());
         copy.setProcessExpiresFrequency(getProcessExpiresFrequency());
         copy.setNotifyListenersOnReplication(isNotifyListenersOnReplication());
         copy.setSessionAttributeNameFilter(getSessionAttributeNameFilter());

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java?rev=1725652&r1=1725651&r2=1725652&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java Tue Jan 
19 23:43:11 2016
@@ -1305,7 +1305,7 @@ public class DeltaManager extends Cluste
         session.setCreationTime(msg.getTimestamp());
         // use container maxInactiveInterval so that session will expire 
correctly
         // in case of primary transfer
-        session.setMaxInactiveInterval(getMaxInactiveInterval(), false);
+        session.setMaxInactiveInterval(getContext().getSessionTimeout() * 60, 
false);
         session.access();
         session.setId(msg.getSessionID(), notifySessionListenersOnReplication);
         session.resetDeltaRequest();

Modified: tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java?rev=1725652&r1=1725651&r2=1725652&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java Tue Jan 19 
23:43:11 2016
@@ -17,7 +17,6 @@
 package org.apache.catalina.session;
 
 
-import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
 import java.io.IOException;
@@ -59,8 +58,7 @@ import org.apache.tomcat.util.res.String
  *
  * @author Craig R. McClanahan
  */
-public abstract class ManagerBase extends LifecycleMBeanBase
-        implements Manager, PropertyChangeListener {
+public abstract class ManagerBase extends LifecycleMBeanBase implements 
Manager {
 
     private final Log log = LogFactory.getLog(ManagerBase.class); // must not 
be static
 
@@ -76,7 +74,11 @@ public abstract class ManagerBase extend
      * The distributable flag for Sessions created by this Manager.  If this
      * flag is set to <code>true</code>, any user attributes added to a
      * session controlled by this Manager must be Serializable.
+     *
+     * @deprecated Ignored. {@link Context#getDistributable()} always takes
+     *             precedence. Will be removed in Tomcat 9.0.x.
      */
+    @Deprecated
     protected boolean distributable;
 
 
@@ -89,7 +91,11 @@ public abstract class ManagerBase extend
     /**
      * The default maximum inactive interval for Sessions created by
      * this Manager.
+     *
+     * @deprecated Ignored. {@link Context#getSessionTimeout()} always takes
+     *             precedence. Will be removed in Tomcat 9.0.x.
      */
+    @Deprecated
     protected int maxInactiveInterval = 30 * 60;
 
     /**
@@ -371,43 +377,39 @@ public abstract class ManagerBase extend
     }
 
 
+    @Deprecated
     @Override
     public boolean getDistributable() {
-        return this.distributable;
+        Context context = getContext();
+        if (context == null) {
+            return false;
+        }
+        return context.getDistributable();
     }
 
 
-    /**
-     * {@inheritDoc}
-     * <p>
-     * Session attributes do not need to implement {@link java.io.Serializable}
-     * if they are excluded from distribution by
-     * {@link #willAttributeDistribute(String, Object)}.
-     */
+    @Deprecated
     @Override
     public void setDistributable(boolean distributable) {
-
-        boolean oldDistributable = this.distributable;
-        this.distributable = distributable;
-        support.firePropertyChange("distributable",
-                                   Boolean.valueOf(oldDistributable),
-                                   Boolean.valueOf(this.distributable));
+        // NO-OP
     }
 
 
+    @Deprecated
     @Override
     public int getMaxInactiveInterval() {
-        return this.maxInactiveInterval;
+        Context context = getContext();
+        if (context == null) {
+            return -1;
+        }
+        return context.getSessionTimeout() * 60;
     }
 
 
+    @Deprecated
     @Override
     public void setMaxInactiveInterval(int interval) {
-        int oldMaxInactiveInterval = this.maxInactiveInterval;
-        this.maxInactiveInterval = interval;
-        support.firePropertyChange("maxInactiveInterval",
-                                   Integer.valueOf(oldMaxInactiveInterval),
-                                   Integer.valueOf(this.maxInactiveInterval));
+        // NO-OP
     }
 
 
@@ -600,23 +602,17 @@ public abstract class ManagerBase extend
 
     }
 
+
     @Override
     protected void initInternal() throws LifecycleException {
-
         super.initInternal();
 
         if (context == null) {
             throw new 
LifecycleException(sm.getString("managerBase.contextNull"));
         }
-
-        // Copy current values from Context
-        setMaxInactiveInterval(this.context.getSessionTimeout() * 60);
-        setDistributable(getContext().getDistributable());
-
-        // Track any further changes in those values
-        this.context.addPropertyChangeListener(this);
     }
 
+
     @Override
     protected void startInternal() throws LifecycleException {
 
@@ -656,6 +652,7 @@ public abstract class ManagerBase extend
         }
     }
 
+
     @Override
     protected void stopInternal() throws LifecycleException {
         if (sessionIdGenerator instanceof Lifecycle) {
@@ -665,17 +662,6 @@ public abstract class ManagerBase extend
 
 
     @Override
-    protected void destroyInternal() throws LifecycleException {
-        // De-register from the old Context (if any)
-        if (this.context != null) {
-            this.context.removePropertyChangeListener(this);
-        }
-
-        super.destroyInternal();
-    }
-
-
-    @Override
     public void add(Session session) {
         sessions.put(session.getIdInternal(), session);
         int size = getActiveSessions();
@@ -1325,30 +1311,6 @@ public abstract class ManagerBase extend
     }
 
 
-    // ----------------------------------------- PropertyChangeListener Methods
-
-    @Override
-    public void propertyChange(PropertyChangeEvent event) {
-
-        // Validate the source of this event
-        if (!(event.getSource() instanceof Context))
-            return;
-
-        // Process a relevant property change
-        if (event.getPropertyName().equals("sessionTimeout")) {
-            try {
-                setMaxInactiveInterval(
-                        ((Integer) event.getNewValue()).intValue() * 60);
-            } catch (NumberFormatException e) {
-                log.error(sm.getString("managerBase.sessionTimeout",
-                        event.getNewValue()));
-            }
-        } else if (event.getPropertyName().equals("distributable")) {
-            setDistributable(((Boolean) event.getNewValue()).booleanValue());
-        }
-    }
-
-
     // ----------------------------------------------------------- Inner 
classes
 
     protected static final class SessionTiming {

Modified: 
tomcat/trunk/test/org/apache/catalina/session/TestPersistentManager.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/session/TestPersistentManager.java?rev=1725652&r1=1725651&r2=1725652&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/session/TestPersistentManager.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/session/TestPersistentManager.java 
Tue Jan 19 23:43:11 2016
@@ -106,6 +106,7 @@ public class TestPersistentManager exten
 
         // No file system docBase required
         StandardContext ctx = (StandardContext) tomcat.addContext("", null);
+        ctx.setDistributable(true);
 
         Tomcat.addServlet(ctx, "DummyServlet", new DummyServlet());
         ctx.addServletMapping("/dummy", "DummyServlet");
@@ -115,7 +116,6 @@ public class TestPersistentManager exten
 
         manager.setStore(store);
         manager.setMaxIdleBackup(0);
-        manager.setDistributable(true);
         ctx.setManager(manager);
         ctx.addValve(new PersistentValve());
         tomcat.start();
@@ -138,6 +138,7 @@ public class TestPersistentManager exten
 
         // No file system docBase required
         StandardContext ctx = (StandardContext) tomcat.addContext("", null);
+        ctx.setDistributable(true);
 
         Tomcat.addServlet(ctx, "DummyServlet", new DummyServlet());
         ctx.addServletMapping("/dummy", "DummyServlet");
@@ -147,7 +148,6 @@ public class TestPersistentManager exten
 
         manager.setStore(store);
         manager.setMaxIdleBackup(0);
-        manager.setDistributable(true);
         ctx.setManager(manager);
         ctx.addValve(new PersistentValve());
         tomcat.start();
@@ -170,6 +170,7 @@ public class TestPersistentManager exten
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
+        ctx.setDistributable(true);
 
         Tomcat.addServlet(ctx, "DummyServlet", new DummyServlet());
         ctx.addServletMapping("/dummy", "DummyServlet");
@@ -179,7 +180,6 @@ public class TestPersistentManager exten
 
         manager.setStore(store);
         manager.setMaxIdleBackup(0);
-        manager.setDistributable(true);
         ctx.setManager(manager);
         tomcat.start();
         String sessionId = getUrl("http://localhost:"; + getPort() + "/dummy")

Modified: tomcat/trunk/webapps/docs/config/manager.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/manager.xml?rev=1725652&r1=1725651&r2=1725652&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/manager.xml (original)
+++ tomcat/trunk/webapps/docs/config/manager.xml Tue Jan 19 23:43:11 2016
@@ -66,6 +66,8 @@
       </attribute>
 
       <attribute name="distributable" required="false">
+        <p><strong>Deprecated</strong>: This should be configured via the
+        Context.</p>
         <p>Set to <code>true</code> to ask the session manager to enforce
         the restrictions described in the Servlet Specification on
         distributable applications (primarily, this would mean that all
@@ -89,6 +91,8 @@
       </attribute>
 
       <attribute name="maxInactiveInterval" required="false">
+        <p><strong>Deprecated</strong>: This should be configured via the
+        Context.</p>
         <p>The initial maximum time interval, in seconds,
         between client requests before a session is invalidated. A negative 
value
         will result in sessions never timing out. If the attribute is not 
provided,



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

Reply via email to