[jboss-cvs] JBossAS SVN: r75558 - in branches/Branch_4_2: server/src/resources/dtd and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jul 9 12:50:17 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-07-09 12:50:17 -0400 (Wed, 09 Jul 2008)
New Revision: 75558

Modified:
   branches/Branch_4_2/server/src/main/org/jboss/metadata/WebMetaData.java
   branches/Branch_4_2/server/src/resources/dtd/jboss-web_4_2.dtd
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/test/JBossWebXmlParsingTestCase.java
   branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/DeployerConfig.java
   branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/JBossWeb.java
   branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/JBossWebMBean.java
   branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/TomcatDeployer.java
   branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
   branches/Branch_4_2/tomcat/src/resources/jboss-service-all.xml
   branches/Branch_4_2/tomcat/src/resources/jboss-service.xml
   branches/Branch_4_2/tomcat/src/resources/webserver-xmbean.xml
Log:
[JBAS-5706] Remove max-unreplicated-interval from DTD, expose global config via jboss-web.deployer

Modified: branches/Branch_4_2/server/src/main/org/jboss/metadata/WebMetaData.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/metadata/WebMetaData.java	2008-07-09 16:35:12 UTC (rev 75557)
+++ branches/Branch_4_2/server/src/main/org/jboss/metadata/WebMetaData.java	2008-07-09 16:50:17 UTC (rev 75558)
@@ -162,7 +162,7 @@
    
    /** By default replicate clustered session metadata at least every 60 seconds */
    public static final int DEFAULT_MAX_UNREPLICATED_INTERVAL = 60;   
-   private int maxUnreplicatedInterval = DEFAULT_MAX_UNREPLICATED_INTERVAL;
+   private Integer maxUnreplicatedInterval = null;
    
    /** Should the context use session cookies or use default */
    private int sessionCookies = SESSION_COOKIES_DEFAULT;
@@ -829,12 +829,12 @@
       this.replicationFieldBatchMode = batchMode;
    }
 
-   public int getMaxUnreplicatedInterval()
+   public Integer getMaxUnreplicatedInterval()
    {
       return maxUnreplicatedInterval;
    }
 
-   public void setMaxUnreplicatedInterval(int maxUnreplicatedInterval)
+   public void setMaxUnreplicatedInterval(Integer maxUnreplicatedInterval)
    {
       this.maxUnreplicatedInterval = maxUnreplicatedInterval;
    }
@@ -1345,8 +1345,7 @@
             String maxUnrep =  MetaData.getElementContent(maxUnreplicatedIntervalElement);
             try
             {
-               Integer interval = Integer.valueOf(maxUnrep);
-               maxUnreplicatedInterval = interval.intValue();
+               maxUnreplicatedInterval = Integer.valueOf(maxUnrep);
             }
             catch (NumberFormatException e)
             {

Modified: branches/Branch_4_2/server/src/resources/dtd/jboss-web_4_2.dtd
===================================================================
--- branches/Branch_4_2/server/src/resources/dtd/jboss-web_4_2.dtd	2008-07-09 16:35:12 UTC (rev 75557)
+++ branches/Branch_4_2/server/src/resources/dtd/jboss-web_4_2.dtd	2008-07-09 16:50:17 UTC (rev 75558)
@@ -297,7 +297,7 @@
 <!--
    HTTP Session clustering configuration (optional tags)
 -->
-<!ELEMENT replication-config (replication-trigger?, replication-granularity, replication-field-batch-mode?, max-unreplicated-interval?)>
+<!ELEMENT replication-config (replication-trigger?, replication-granularity, replication-field-batch-mode?)>
 
 <!--
    Clustering only: Determines when the container should consider that a session
@@ -372,38 +372,6 @@
          <replication-field-batch-mode>FALSE</replication-field-batch-mode>
 -->
 <!ELEMENT replication-field-batch-mode (true|false)>
-
-<!--
-   Clustering only: Determines the maximum interval between requests, in 
-   seconds, after which a request will trigger replication of the session's 
-   timestamp and other metadata regardless of whether the request has otherwise 
-   made the session dirty.  Such replication ensures that other nodes in the 
-   cluster are aware of the most recent value for the session's timestamp 
-   and won't incorrectly expire an unreplicated session upon failover. It also
-   results in correct values for HttpSession.getLastAccessedTime() calls 
-   following failover.
-
-   The cost of this metadata replication depends on the configured
-   replication-granularity. With <code>SESSION</code>, the session's 
-   attribute map is replicated along with the metadata, so it can be fairly 
-   costly.  With other granularities, the metadata object is replicated 
-   separately from the attributes and only contains a String, and a few longs, 
-   ints and booleans.
-   
-   A value of 0 means the metadata will be replicated whenever the session is
-   accessed.  A value of -1 means the metadata will be replicated only if some
-   other activity during the request (e.g. modifying an attribute) has
-   resulted in other replication work involving the session. A positive value
-   greater than the HttpSession.getMaxInactiveInterval() value will be treated 
-   as a likely misconfiguration and converted to 0 -- i.e. replicate the 
-   metadata on every request.
-    
-   Default value is 60 seconds.
-   
-   This element was added in releases 4.2.3.GA, EAP 4.2.0.CP04 and EAP 4.2.0.CP02.
-   In releases prior to those it has no effect.
--->
-<!ELEMENT max-unreplicated-interval (#PCDATA)>
 
 <!--
 Runtime information about a web service.

Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/test/JBossWebXmlParsingTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/test/JBossWebXmlParsingTestCase.java	2008-07-09 16:35:12 UTC (rev 75557)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/test/JBossWebXmlParsingTestCase.java	2008-07-09 16:50:17 UTC (rev 75558)
@@ -67,7 +67,8 @@
    public void testDefault() throws Exception
    {      
       WebMetaData metadata = getWebMetaData(DEFAULT);
-      defaultCheck(metadata);      
+      assertEquals("Max unreplicated", new Integer(WebMetaData.DEFAULT_MAX_UNREPLICATED_INTERVAL), metadata.getMaxUnreplicatedInterval());
+      defaultCheck(metadata, Element.MAX);
    }
    
    public void testEmpty() throws Exception
@@ -124,7 +125,7 @@
    public void testMaxUnreplicatedInterval() throws Exception
    {
       WebMetaData metadata = getWebMetaData(NO_MAX);
-      assertEquals("Max unreplicated", -1, metadata.getMaxUnreplicatedInterval());
+      assertEquals("Max unreplicated", new Integer(-1), metadata.getMaxUnreplicatedInterval());
       defaultCheck(metadata, Element.MAX);
    }
    
@@ -176,7 +177,7 @@
       }
       if (!ignore.contains(Element.MAX))
       {
-         assertEquals("Max unreplicated", WebMetaData.DEFAULT_MAX_UNREPLICATED_INTERVAL, metadata.getMaxUnreplicatedInterval());
+         assertEquals("Max unreplicated", null, metadata.getMaxUnreplicatedInterval());
       }
    }
 }

Modified: branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/DeployerConfig.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/DeployerConfig.java	2008-07-09 16:35:12 UTC (rev 75557)
+++ branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/DeployerConfig.java	2008-07-09 16:50:17 UTC (rev 75558)
@@ -108,6 +108,12 @@
     * if it detects a failover.
     */
    private boolean useJK = false;
+   
+   /**
+    * Maximum interval a clustered session should allow request to not
+    * replicate the session timestamp. 
+    */
+   private int maxUnreplicatedInterval;
 
    /**
     * Get the request attribute name under which the JAAS Subject is store
@@ -287,6 +293,16 @@
       this.useJK = useJK;
    }
 
+   public int getMaxUnreplicatedInterval()
+   {
+      return maxUnreplicatedInterval;
+   }
+
+   public void setMaxUnreplicatedInterval(int maxUnreplicatedInterval)
+   {
+      this.maxUnreplicatedInterval = maxUnreplicatedInterval;
+   }
+
    public String getSubjectAttributeName()
    {
       return subjectAttributeName;

Modified: branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/JBossWeb.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/JBossWeb.java	2008-07-09 16:35:12 UTC (rev 75557)
+++ branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/JBossWeb.java	2008-07-09 16:50:17 UTC (rev 75558)
@@ -41,6 +41,7 @@
 import org.apache.tomcat.util.modeler.Registry;
 import org.jboss.deployment.DeploymentInfo;
 import org.jboss.deployment.SubDeployerExt;
+import org.jboss.metadata.WebMetaData;
 import org.jboss.mx.util.MBeanProxyExt;
 import org.jboss.security.plugins.JaasSecurityManagerServiceMBean;
 import org.jboss.system.ServiceControllerMBean;
@@ -130,6 +131,12 @@
     * Whether we are using Apache MOD_JK(2) module or not
     */
    private boolean useJK = false;
+   
+   /**
+    * Maximum interval a clustered session should allow request to not
+    * replicate the session timestamp. 
+    */
+   private int maxUnreplicatedInterval = WebMetaData.DEFAULT_MAX_UNREPLICATED_INTERVAL;
 
    /**
     * A flag indicating if the JBoss Loader should be used
@@ -301,8 +308,18 @@
    public void setUseJK(boolean useJK)
    {
       this.useJK = useJK;
-   } 
+   }
 
+   public int getMaxUnreplicatedInterval()
+   {
+      return maxUnreplicatedInterval;
+   }
+
+   public void setMaxUnreplicatedInterval(int maxUnreplicatedInterval)
+   {
+      this.maxUnreplicatedInterval = maxUnreplicatedInterval;
+   }
+
    public boolean getDeleteWorkDirOnContextDestroy()
    {
       return deleteWorkDirOnContextDestroy;
@@ -647,6 +664,7 @@
       config.setSnapshotMode(this.snapshotMode);
       config.setUseLocalCache(this.useLocalCache);
       config.setUseJK(this.useJK);
+      config.setMaxUnreplicatedInterval(this.maxUnreplicatedInterval);
       config.setSubjectAttributeName(this.subjectAttributeName);
       config.setUseJBossWebLoader(this.useJBossWebLoader);
       config.setAllowSelfPrivilegedWebApps(this.allowSelfPrivilegedWebApps);

Modified: branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/JBossWebMBean.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/JBossWebMBean.java	2008-07-09 16:35:12 UTC (rev 75557)
+++ branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/JBossWebMBean.java	2008-07-09 16:50:17 UTC (rev 75558)
@@ -124,6 +124,45 @@
    public void setCacheName(String cacheName);
 
    /**
+    * Get the maximum interval between requests, in seconds, after which a
+    * request will trigger replication of the session's metadata regardless
+    * of whether the request has otherwise made the session dirty. Such 
+    * replication ensures that other nodes in the cluster are aware of a 
+    * relatively recent value for the session's timestamp and won't incorrectly
+    * expire an unreplicated session upon failover.
+    * <p/>
+    * Default value is {@link #DEFAULT_MAX_UNREPLICATED_INTERVAL}.
+    * <p/>
+    * The cost of the metadata replication depends on the configured
+    * {@link #setReplicationGranularityString(String) replication granularity}.
+    * With <code>SESSION</code>, the sesssion's attribute map is replicated 
+    * along with the metadata, so it can be fairly costly.  With other 
+    * granularities, the metadata object is replicated separately from the
+    * attributes and only contains a String, and a few longs, ints and booleans.
+    * 
+    * @return the maximum interval since last replication after which a request
+    *         will trigger session metadata replication. A value of 
+    *         <code>0</code> means replicate metadata on every request; a value 
+    *         of <code>-1</code> means never replicate metadata unless the 
+    *         session is otherwise dirty.
+    */
+   public int getMaxUnreplicatedInterval();
+
+   /**
+    * Sets the maximum interval between requests, in seconds, after which a
+    * request will trigger replication of the session's metadata regardless
+    * of whether the request has otherwise made the session dirty.
+    * 
+    * @param  maxUnreplicatedInterval  
+    *         the maximum interval since last replication after which a request
+    *         will trigger session metadata replication. A value of 
+    *         <code>0</code> means replicate metadata on every request; a value 
+    *         of <code>-1</code> means never replicate metadata unless the 
+    *         session is otherwise dirty.
+    */
+   public void setMaxUnreplicatedInterval(int maxUnreplicatedInterval);
+
+   /**
     * Get the JBoss UCL use flag
     */
    public boolean getUseJBossWebLoader();

Modified: branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/TomcatDeployer.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/TomcatDeployer.java	2008-07-09 16:35:12 UTC (rev 75557)
+++ branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/TomcatDeployer.java	2008-07-09 16:50:17 UTC (rev 75558)
@@ -332,6 +332,13 @@
                jbcm.setSnapshotInterval(snapshotInterval);
             }
             
+            // JBAS-5706 -- use the DeployerConfig value as a default for
+            // WebMetaData.maxUnreplicatedInterval
+            if (metaData.getMaxUnreplicatedInterval() == null)
+            {
+               metaData.setMaxUnreplicatedInterval(new Integer(config.getMaxUnreplicatedInterval()));
+            }
+            
             String name = "//" + ((hostName == null) ? "localhost" : hostName) + ctxPath;
             manager.init(name, metaData, config.isUseJK(), config.isUseLocalCache());
             

Modified: branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java	2008-07-09 16:35:12 UTC (rev 75557)
+++ branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java	2008-07-09 16:50:17 UTC (rev 75558)
@@ -167,7 +167,11 @@
       this.replicationFieldBatchMode_ =
          webMetaData.getReplicationFieldBatchMode() ? Boolean.TRUE : Boolean.FALSE;
       
-      this.maxUnreplicatedInterval_ = webMetaData.getMaxUnreplicatedInterval();
+      Integer maxUnrep = webMetaData.getMaxUnreplicatedInterval();
+      if (maxUnrep != null)
+      {
+         this.maxUnreplicatedInterval_ = maxUnrep.intValue();
+      }
       
       if (proxy_ == null)
          proxy_ = new JBossCacheService(cacheObjectNameString_);

Modified: branches/Branch_4_2/tomcat/src/resources/jboss-service-all.xml
===================================================================
--- branches/Branch_4_2/tomcat/src/resources/jboss-service-all.xml	2008-07-09 16:35:12 UTC (rev 75557)
+++ branches/Branch_4_2/tomcat/src/resources/jboss-service-all.xml	2008-07-09 16:50:17 UTC (rev 75558)
@@ -141,6 +141,35 @@
       -->
       <attribute name="UseJK">false</attribute>
 
+      <!--
+       Clustering only: Determines the maximum interval between requests, in 
+       seconds, after which a request will trigger replication of the session's 
+       timestamp and other metadata regardless of whether the request has otherwise 
+       made the session dirty.  Such replication ensures that other nodes in the 
+       cluster are aware of the most recent value for the session's timestamp 
+       and won't incorrectly expire an unreplicated session upon failover. It also
+       results in correct values for HttpSession.getLastAccessedTime() calls 
+       following failover.
+
+       The cost of this metadata replication depends on the configured
+       replication-granularity. With <code>SESSION</code>, the session's 
+       attribute map is replicated along with the metadata, so it can be fairly 
+       costly.  With other granularities, the metadata object is replicated 
+       separately from the attributes and only contains a String, and a few longs, 
+       ints and booleans.
+   
+       A value of 0 means the metadata will be replicated whenever the session is
+       accessed.  A value of -1 means the metadata will be replicated only if some
+       other activity during the request (e.g. modifying an attribute) has
+       resulted in other replication work involving the session. A positive value
+       greater than the HttpSession.getMaxInactiveInterval() value will be treated 
+       as a likely misconfiguration and converted to 0; i.e. replicate the 
+       metadata on every request.
+    
+       Default value if unconfigured is 60 seconds.
+      -->
+      <attribute name="MaxUnreplicatedInterval">60</attribute>
+
       <attribute name="Domain">jboss.web</attribute>
 
       <!-- A mapping to the server security manager service which must be

Modified: branches/Branch_4_2/tomcat/src/resources/jboss-service.xml
===================================================================
--- branches/Branch_4_2/tomcat/src/resources/jboss-service.xml	2008-07-09 16:35:12 UTC (rev 75557)
+++ branches/Branch_4_2/tomcat/src/resources/jboss-service.xml	2008-07-09 16:50:17 UTC (rev 75558)
@@ -143,6 +143,35 @@
       -->
       <attribute name="UseJK">false</attribute>
 
+      <!--
+       Clustering only: Determines the maximum interval between requests, in 
+       seconds, after which a request will trigger replication of the session's 
+       timestamp and other metadata regardless of whether the request has otherwise 
+       made the session dirty.  Such replication ensures that other nodes in the 
+       cluster are aware of the most recent value for the session's timestamp 
+       and won't incorrectly expire an unreplicated session upon failover. It also
+       results in correct values for HttpSession.getLastAccessedTime() calls 
+       following failover.
+
+       The cost of this metadata replication depends on the configured
+       replication-granularity. With <code>SESSION</code>, the session's 
+       attribute map is replicated along with the metadata, so it can be fairly 
+       costly.  With other granularities, the metadata object is replicated 
+       separately from the attributes and only contains a String, and a few longs, 
+       ints and booleans.
+   
+       A value of 0 means the metadata will be replicated whenever the session is
+       accessed.  A value of -1 means the metadata will be replicated only if some
+       other activity during the request (e.g. modifying an attribute) has
+       resulted in other replication work involving the session. A positive value
+       greater than the HttpSession.getMaxInactiveInterval() value will be treated 
+       as a likely misconfiguration and converted to 0; i.e. replicate the 
+       metadata on every request.
+    
+       Default value if unconfigured is 60 seconds.
+      -->
+      <attribute name="MaxUnreplicatedInterval">60</attribute>
+
       <attribute name="Domain">jboss.web</attribute>
 
       <!-- A mapping to the server security manager service which must be

Modified: branches/Branch_4_2/tomcat/src/resources/webserver-xmbean.xml
===================================================================
--- branches/Branch_4_2/tomcat/src/resources/webserver-xmbean.xml	2008-07-09 16:35:12 UTC (rev 75557)
+++ branches/Branch_4_2/tomcat/src/resources/webserver-xmbean.xml	2008-07-09 16:50:17 UTC (rev 75558)
@@ -87,6 +87,11 @@
      <type>boolean</type>
    </attribute>
 
+   <attribute access="read-write" getMethod="getMaxUnreplicatedInterval" setMethod="setMaxUnreplicatedInterval">
+     <name>MaxUnreplicatedInterval</name>
+     <type>int</type>
+   </attribute>
+
    <attribute access="read-write" getMethod="getDomain" setMethod="setDomain">
      <name>Domain</name>
      <type>java.lang.String</type>




More information about the jboss-cvs-commits mailing list