[jboss-cvs] JBossAS SVN: r66989 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/session.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 12 16:47:10 EST 2007
Author: bstansberry at jboss.com
Date: 2007-11-12 16:47:10 -0500 (Mon, 12 Nov 2007)
New Revision: 66989
Removed:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/InvalidateSessionPolicy.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ReplicationGranularity.java
Modified:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/AbstractJBossManager.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/CacheListener.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheCluster.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManagerMBean.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossManager.java
Log:
[JBAS-4967] Extract setting of default clustering JBossWebMetaData from TomcatDeployer
[JBAS-4960] Fix clustering related elements of JBossWebMetaData
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/AbstractJBossManager.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/AbstractJBossManager.java 2007-11-12 21:45:38 UTC (rev 66988)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/AbstractJBossManager.java 2007-11-12 21:47:10 UTC (rev 66989)
@@ -26,6 +26,7 @@
import org.apache.catalina.Session;
import org.apache.catalina.Manager;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.jboss.ReplicationTrigger;
/** Common interface for the http session replication managers.
*
@@ -42,10 +43,10 @@
public void init(String name, JBossWebMetaData webMetaData)
throws ClusteringNotSupportedException;
- /** The session invalidation policy.
- * @return the invalidation policy constant
+ /**
+ * Gets the event type(s) that indicate a need to replicate the session.
*/
- public InvalidateSessionPolicy getInvalidateSessionPolicy();
+ public ReplicationTrigger getReplicationTrigger();
/**
* Retrieve the JvmRoute for the enclosing Engine.
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/CacheListener.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/CacheListener.java 2007-11-12 21:45:38 UTC (rev 66988)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/CacheListener.java 2007-11-12 21:47:10 UTC (rev 66989)
@@ -34,6 +34,7 @@
import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.cache.notifications.event.NodeRemovedEvent;
import org.jboss.logging.Logger;
+import org.jboss.metadata.web.jboss.ReplicationGranularity;
@org.jboss.cache.notifications.annotation.CacheListener
public class CacheListener extends CacheListenerBase
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java 2007-11-12 21:45:38 UTC (rev 66988)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java 2007-11-12 21:47:10 UTC (rev 66989)
@@ -49,6 +49,7 @@
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.StringManager;
import org.jboss.logging.Logger;
+import org.jboss.metadata.web.jboss.ReplicationTrigger;
/**
* Abstract base class for session clustering based on StandardSession. Different session
@@ -93,7 +94,7 @@
replicationExcludes = Collections.unmodifiableSet(set);
}
- protected InvalidateSessionPolicy invalidationPolicy;
+ protected ReplicationTrigger invalidationPolicy;
/**
* If true, means the local in-memory session data contains
@@ -196,7 +197,7 @@
protected ClusteredSession(AbstractJBossManager manager, boolean useJK)
{
super(manager);
- invalidationPolicy = manager.getInvalidateSessionPolicy();
+ invalidationPolicy = manager.getReplicationTrigger();
this.useJK = useJK;
this.firstAccess = true;
calcMaxUnreplicatedInterval();
@@ -471,7 +472,7 @@
setNew(false);
}
- if (invalidationPolicy == InvalidateSessionPolicy.ACCESS)
+ if (invalidationPolicy == ReplicationTrigger.ACCESS)
{
this.sessionMetadataDirty();
}
@@ -1006,7 +1007,7 @@
listeners.clear();
support = new PropertyChangeSupport(this);
- invalidationPolicy = InvalidateSessionPolicy.ACCESS;
+ invalidationPolicy = ReplicationTrigger.ACCESS;
outdatedTime = 0;
outdatedVersion = 0;
sessionAttributesDirty = false;
@@ -1124,7 +1125,7 @@
// From ClusteredSession
- invalidationPolicy = InvalidateSessionPolicy.fromInt(in.readInt());
+ invalidationPolicy = ReplicationTrigger.fromInt(in.readInt());
version = in.readInt();
// Get our id without any jvmRoute appended
Deleted: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/InvalidateSessionPolicy.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/InvalidateSessionPolicy.java 2007-11-12 21:45:38 UTC (rev 66988)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/InvalidateSessionPolicy.java 2007-11-12 21:47:10 UTC (rev 66989)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.web.tomcat.service.session;
-
-public enum InvalidateSessionPolicy
-{
- ACCESS, SET_AND_GET, SET_AND_NON_PRIMITIVE_GET, SET;
-
- public static InvalidateSessionPolicy fromString(String policy)
- {
- return (policy == null ? InvalidateSessionPolicy.SET_AND_NON_PRIMITIVE_GET
- : Enum.valueOf(InvalidateSessionPolicy.class, policy));
- }
-
- public static InvalidateSessionPolicy fromInt(int ordinal)
- {
- switch (ordinal)
- {
- case 2:
- return SET_AND_NON_PRIMITIVE_GET;
- case 3:
- return SET;
- case 1:
- return SET_AND_GET;
- case 0:
- return ACCESS;
- default:
- throw new IllegalArgumentException("Unknown ordinal " + ordinal);
- }
- }
-}
\ No newline at end of file
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheCluster.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheCluster.java 2007-11-12 21:45:38 UTC (rev 66988)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheCluster.java 2007-11-12 21:47:10 UTC (rev 66989)
@@ -47,6 +47,9 @@
import org.jboss.cache.pojo.jmx.PojoCacheJmxWrapper;
import org.jboss.cache.pojo.jmx.PojoCacheJmxWrapperMBean;
import org.jboss.cache.transaction.BatchModeTransactionManagerLookup;
+import org.jboss.metadata.web.jboss.ReplicationGranularity;
+import org.jboss.metadata.web.jboss.ReplicationTrigger;
+import org.jboss.metadata.web.jboss.SnapshotMode;
import org.jboss.mx.util.MBeanProxyExt;
import org.jboss.mx.util.MBeanServerLocator;
@@ -135,18 +138,18 @@
* Default replication trigger to assign to our
* Managers that haven't had this property set.
*/
- private String defaultReplicationTrigger = null;
+ private ReplicationTrigger defaultReplicationTrigger = null;
/**
* Default replication granularity to assign to our Managers
* that haven't had this property set.
*/
- private String defaultReplicationGranularity = null;
+ private ReplicationGranularity defaultReplicationGranularity = null;
/**
* JBossCacheManager's snapshot mode.
*/
- private String snapshotMode = null;
+ private SnapshotMode snapshotMode = null;
/**
* JBossCacheManager's snapshot interval.
@@ -154,7 +157,7 @@
private int snapshotInterval = 0;
/** Whether we use batch mode replication for field level granularity */
- private boolean replicationFieldBatchMode;
+ private boolean replicationFieldBatchMode = true;
// ---------------------------------------------------------- Constructors
@@ -343,7 +346,7 @@
*/
public String getDefaultReplicationGranularity()
{
- return defaultReplicationGranularity;
+ return defaultReplicationGranularity == null ? null : defaultReplicationGranularity.toString();
}
/**
@@ -359,7 +362,7 @@
public void setDefaultReplicationGranularity(
String defaultReplicationGranularity)
{
- this.defaultReplicationGranularity = defaultReplicationGranularity;
+ this.defaultReplicationGranularity = (defaultReplicationGranularity == null ? null : ReplicationGranularity.fromString(defaultReplicationGranularity.toUpperCase()));
}
/**
@@ -375,7 +378,7 @@
*/
public String getDefaultReplicationTrigger()
{
- return defaultReplicationTrigger;
+ return defaultReplicationTrigger == null ? null : defaultReplicationTrigger.toString();
}
/**
@@ -391,7 +394,7 @@
*/
public void setDefaultReplicationTrigger(String defaultTrigger)
{
- this.defaultReplicationTrigger = defaultTrigger;
+ this.defaultReplicationTrigger = (defaultTrigger == null ? null : ReplicationTrigger.fromString(defaultTrigger.toUpperCase()));
}
/**
@@ -431,7 +434,7 @@
*/
public String getSnapshotMode()
{
- return snapshotMode;
+ return snapshotMode == null ? null : snapshotMode.toString();
}
/**
@@ -445,7 +448,7 @@
*/
public void setSnapshotMode(String snapshotMode)
{
- this.snapshotMode = snapshotMode;
+ this.snapshotMode = (snapshotMode == null ? null : SnapshotMode.fromString(snapshotMode.toUpperCase()));
}
/**
@@ -622,20 +625,19 @@
manager.setSnapshotMode(snapshotMode);
manager.setSnapshotInterval(snapshotInterval);
manager.setUseJK(useJK);
- manager.setUseLocalCache(useLocalCache);
manager.setCacheObjectNameString(pojoCacheObjectName);
// Only set replication attributes if they were not
// already set via a <Manager> element in an XML config file
- if (manager.getReplicationGranularityString() == null)
+ if (manager.getReplicationGranularity() == null)
{
- manager.setReplicationGranularityString(defaultReplicationGranularity);
+ manager.setReplicationGranularity(defaultReplicationGranularity);
}
- if (manager.getReplicationTriggerString() == null)
+ if (manager.getReplicationTrigger() == null)
{
- manager.setReplicationTriggerString(defaultReplicationTrigger);
+ manager.setReplicationTrigger(defaultReplicationTrigger);
}
if (manager.isReplicationFieldBatchMode() == null)
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java 2007-11-12 21:45:38 UTC (rev 66988)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java 2007-11-12 21:47:10 UTC (rev 66989)
@@ -48,6 +48,9 @@
import org.jboss.cache.pojo.PojoCache;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.jboss.ReplicationConfig;
+import org.jboss.metadata.web.jboss.ReplicationGranularity;
+import org.jboss.metadata.web.jboss.ReplicationTrigger;
+import org.jboss.metadata.web.jboss.SnapshotMode;
import org.jboss.mx.util.MBeanServerLocator;
/**
@@ -100,7 +103,7 @@
/**
* If set to true, will add a JvmRouteFilter to the request.
*/
- private boolean useJK_ = false;
+ private Boolean useJK_;
/** Are we running embedded in JBoss? */
private boolean embedded_ = false;
@@ -109,17 +112,16 @@
private MBeanServer mserver_ = null;
/** Our ClusteredSessionValve's snapshot mode. */
- private String snapshotMode_ = null;
+ private SnapshotMode snapshotMode_ = null;
/** Our ClusteredSessionValve's snapshot interval. */
private int snapshotInterval_ = 0;
+
+ /**
+ * Replication granulairty.
+ */
+ private ReplicationGranularity replicationGranularity_;
- /** String form of invalidateSessionPolicy_ */
- private String replTriggerString_ = null;
-
- /** String form of replGranularityString_ */
- private String replGranularityString_ = null;
-
/**
* Whether we use batch mode replication for field level granularity.
* We store this in a Boolean rather than a primitive so JBossCacheCluster
@@ -161,17 +163,29 @@
super.init(name, webMetaData);
ReplicationConfig repCfg = webMetaData.getReplicationConfig();
- this.useJK_ = Boolean.parseBoolean(repCfg.getUseJK());
- String batch = repCfg.getFieldBatchMode();
- this.replicationFieldBatchMode_ =
- (batch == null || Boolean.parseBoolean(batch))
- ? Boolean.TRUE : Boolean.FALSE;
- setSnapshotMode(repCfg.getSnapshotMode());
- if (repCfg.getSnapshotInterval() != null)
+
+ replicationGranularity_ = repCfg.getReplicationGranularity();
+
+ // Only configure JK usage if it was explicitly set; otherwise
+ // wait until we're starting when we can check for a jvmRoute
+ // in our containing Engine
+ Boolean jk = repCfg.getUseJKBoolean();
+ if (jk != null)
{
- setSnapshotInterval(Integer.parseInt(repCfg.getSnapshotInterval()));
+ this.useJK_ = jk;
}
+ Boolean batch = repCfg.getReplicationFieldBatchMode();
+ this.replicationFieldBatchMode_ = (batch == null ? Boolean.TRUE : batch);
+ setSnapshotMode(repCfg.getSnapshotModeEnum());
+ setSnapshotInterval(repCfg.getSnapshotIntervalInteger());
+
+ log_.debug("init(): replicationGranularity_ is " + replicationGranularity_ +
+ " and replicationFieldBatchMode is " + replicationFieldBatchMode_ +
+ " and useJK is " + useJK_ +
+ " and snapshotMode is " + snapshotMode_ +
+ " and snapshotInterval is " + snapshotInterval_);
+
PojoCache pc = getPojoCache();
if (pc == null)
{
@@ -229,7 +243,7 @@
*
* @see #getSnapshotInterval()
*/
- public String getSnapshotMode()
+ public SnapshotMode getSnapshotMode()
{
return snapshotMode_;
}
@@ -241,7 +255,7 @@
* <li>interval</li>
* </ul>
*/
- public void setSnapshotMode(String snapshotMode)
+ public void setSnapshotMode(SnapshotMode snapshotMode)
{
this.snapshotMode_ = snapshotMode;
}
@@ -275,7 +289,7 @@
*/
public boolean getUseJK()
{
- return useJK_;
+ return useJK_ == null ? false : useJK_.booleanValue();
}
/**
@@ -288,7 +302,7 @@
}
/**
- * Returns the replication granularity expressed as an int.
+ * Returns the replication granularity.
*
* @see JBossWebMetaData#REPLICATION_GRANULARITY_ATTRIBUTE
* @see JBossWebMetaData#REPLICATION_GRANULARITY_FIELD
@@ -300,23 +314,6 @@
}
/**
- * Gets the granularity of session data replicated across the
- * cluster; i.e. whether the entire session should be replicated when
- * replication is triggered, only modified attributes, or only
- * modified fields of attributes.
- */
- public String getReplicationGranularityString()
- {
- // Only lazy-set this if we are started;
- // otherwise screws up standalone TC integration!!
- if (started_ && this.replGranularityString_ == null)
- {
- this.replGranularityString_ = replicationGranularity_.toString();
- }
- return replGranularityString_;
- }
-
- /**
* Sets the granularity of session data replicated across the cluster.
* Valid values are:
* <ul>
@@ -325,40 +322,48 @@
* <li>FIELD</li>
* </ul>
*/
- public void setReplicationGranularityString(String granularity)
+ public void setReplicationGranularity(ReplicationGranularity granularity)
{
- this.replGranularityString_ = granularity;
+ this.replicationGranularity_ = granularity;
}
/**
- * Gets the type of operations on a <code>HttpSession</code> that
- * trigger replication.
+ * Returns the replication granularity.
+ *
+ * @see JBossWebMetaData#REPLICATION_GRANULARITY_ATTRIBUTE
+ * @see JBossWebMetaData#REPLICATION_GRANULARITY_FIELD
+ * @see JBossWebMetaData#REPLICATION_GRANULARITY_SESSION
*/
- public String getReplicationTriggerString()
+ public String getReplicationGranularityString()
{
- // Only lazy-set this if we are started;
- // otherwise screws up standalone TC integration!!
- if (started_ && this.replTriggerString_ == null)
- {
- this.replTriggerString_ = invalidateSessionPolicy_.toString();
- }
- return this.replTriggerString_;
+ return replicationGranularity_ == null ? null : replicationGranularity_.toString();
}
/**
- * Sets the type of operations on a <code>HttpSession</code> that
- * trigger replication. Valid values are:
+ * Sets the granularity of session data replicated across the cluster.
+ * Valid values are:
* <ul>
- * <li>SET_AND_GET</li>
- * <li>SET_AND_NON_PRIMITIVE_GET</li>
- * <li>SET</li>
+ * <li>SESSION</li>
+ * <li>ATTRIBUTE</li>
+ * <li>FIELD</li>
* </ul>
*/
- public void setReplicationTriggerString(String trigger)
+ public void setReplicationGranularityString(String granularity)
{
- this.replTriggerString_ = trigger;
+ setReplicationGranularity(granularity == null ? null :
+ ReplicationGranularity.fromString(granularity.toUpperCase()));
+ }
+
+ public String getReplicationTriggerString()
+ {
+ return replicationTrigger_ == null ? null : replicationTrigger_.toString();
}
+ public void setReplicationTriggerString(String trigger)
+ {
+ setReplicationTrigger(trigger == null ? null : ReplicationTrigger.fromString(trigger.toUpperCase()));
+ }
+
/**
* Gets whether, if replication granularity is set to <code>FIELD</code>,
* replication should be done in batch mode. Ignored if field-level
@@ -379,11 +384,6 @@
this.replicationFieldBatchMode_ = Boolean.valueOf(replicationFieldBatchMode);
}
- public void setUseLocalCache(boolean useLocalCache)
- {
- this.useLocalCache_ = useLocalCache;
- }
-
// JBossCacheManagerMBean-methods -------------------------------------
public void expireSession(String sessionId)
@@ -692,7 +692,7 @@
sessionId = this.getNextId();
// We are using mod_jk for load balancing. Append the JvmRoute.
- if (useJK_)
+ if (getUseJK())
{
if (log_.isTraceEnabled())
{
@@ -1682,7 +1682,7 @@
*/
protected String getRealId(String id)
{
- return (useJK_ ? Util.getRealId(id) : id);
+ return (getUseJK() ? Util.getRealId(id) : id);
}
/**
@@ -1801,31 +1801,6 @@
// Validate attributes
- try
- {
- this.invalidateSessionPolicy_ = InvalidateSessionPolicy.fromString(replTriggerString_);
- }
- catch (IllegalArgumentException iae)
- {
- throw new LifecycleException("replication-trigger value set to a " +
- "non-valid value: '" +
- replTriggerString_ +
- "' (should be ['SET_AND_GET', " +
- "'SET_AND_NON_PRIMITIVE_GET', 'SET'])");
- }
-
- try
- {
- }
- catch (IllegalArgumentException iae)
- {
- throw new LifecycleException("replication-granularity value set to " +
- "a non-valid value: '" +
- replGranularityString_ +
- "' (should be ['SESSION', " +
- "'ATTRIBUTE' or 'FIELD'])");
- }
-
// Create the JBossCacheService
try
{
@@ -1999,15 +1974,19 @@
* Instantiate a SnapshotManager and ClusteredSessionValve and add
* the valve to our parent Context's pipeline.
* Add a JvmRouteValve and BatchReplicationClusteredSessionValve if needed.
- *
*/
private void installValves()
{
- if (useJK_)
+ // If JK usage wasn't explicitly configured, default to enabling
+ // it if jvmRoute is set on our containing Engine
+ if (useJK_ == null)
{
- log_.info("We are using mod_jk(2) for load-balancing. " +
- "Will add JvmRouteValve.");
-
+ useJK_ = Boolean.valueOf(getJvmRoute() != null);
+ }
+
+ if (getUseJK())
+ {
+ log_.debug("We are using JK for load-balancing. Adding JvmRouteValve.");
installContextValve(new JvmRouteValve(this));
}
@@ -2033,20 +2012,24 @@
private void initSnapshotManager()
{
String ctxPath = ((Context) container_).getPath();
- if ("instant".equals(snapshotMode_)
- || replicationGranularity_== ReplicationGranularity.FIELD)
+ if (SnapshotMode.INSTANT == snapshotMode_)
{
snapshotManager_ = new InstantSnapshotManager(this, ctxPath);
}
- else if ("interval".equals(snapshotMode_))
+ else if (snapshotMode_ == null)
{
- snapshotManager_ = new IntervalSnapshotManager(this, ctxPath, snapshotInterval_);
+ log_.warn("Snapshot mode must be 'instant' or 'interval' - " +
+ "using 'instant'");
+ snapshotMode_ = SnapshotMode.INSTANT;
+ snapshotManager_ = new InstantSnapshotManager(this, ctxPath);
}
+ else if (ReplicationGranularity.FIELD == replicationGranularity_)
+ {
+ throw new IllegalStateException("Property snapshotMode must be " + SnapshotMode.INTERVAL + " when FIELD granularity is used");
+ }
else
{
- log_.error("Snapshot mode must be 'instant' or 'interval' - " +
- "using 'instant'");
- snapshotManager_ = new InstantSnapshotManager(this, ctxPath);
+ snapshotManager_ = new IntervalSnapshotManager(this, ctxPath, snapshotInterval_);
}
snapshotManager_.start();
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManagerMBean.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManagerMBean.java 2007-11-12 21:45:38 UTC (rev 66988)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManagerMBean.java 2007-11-12 21:47:10 UTC (rev 66989)
@@ -21,6 +21,10 @@
*/
package org.jboss.web.tomcat.service.session;
+import org.jboss.metadata.web.jboss.ReplicationGranularity;
+import org.jboss.metadata.web.jboss.ReplicationTrigger;
+import org.jboss.metadata.web.jboss.SnapshotMode;
+
public interface JBossCacheManagerMBean extends JBossManagerMBean
{
/**
@@ -72,7 +76,7 @@
* @return SESSION, ATTRIBUTE or FIELD, or <code>null</code> if this
* has not yet been configured.
*/
- String getReplicationGranularityString();
+ ReplicationGranularity getReplicationGranularity();
/**
* Gets the replication trigger.
@@ -80,7 +84,7 @@
* @return SET, SET_AND_GET, SET_AND_NON_PRIMITIVE_GET or <code>null</code>
* if this has not yet been configured.
*/
- String getReplicationTriggerString();
+ ReplicationTrigger getReplicationTrigger();
/**
* Gets whether batching of field granularity changes will be done. Only
@@ -102,7 +106,7 @@
*
* @return "instant" or "interval"
*/
- String getSnapshotMode();
+ SnapshotMode getSnapshotMode();
/**
* Gets the number of milliseconds between replications if "interval" mode
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossManager.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossManager.java 2007-11-12 21:45:38 UTC (rev 66988)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossManager.java 2007-11-12 21:47:10 UTC (rev 66989)
@@ -50,6 +50,7 @@
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.jboss.ReplicationConfig;
import org.jboss.metadata.web.jboss.PassivationConfig;
+import org.jboss.metadata.web.jboss.ReplicationTrigger;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.web.tomcat.statistics.ReplicationStatistics;
@@ -78,11 +79,7 @@
/**
* Policy to determine if a session is dirty
*/
- protected InvalidateSessionPolicy invalidateSessionPolicy_ = InvalidateSessionPolicy.SET_AND_NON_PRIMITIVE_GET;
- /**
- * Replication granulairty.
- */
- protected ReplicationGranularity replicationGranularity_ = ReplicationGranularity.SESSION;
+ protected ReplicationTrigger replicationTrigger_;
/**
* Session passivation flag set in jboss-web.xml by the user.
@@ -173,8 +170,10 @@
/**
* If set to true, it will not replicate the access time stamp unless attributes are dirty.
+ *
+ * @deprecated unused
*/
- protected boolean useLocalCache_ = false;
+ protected boolean useLocalCache_ = true;
/**
* The property change support for this component.
@@ -198,11 +197,8 @@
{
ReplicationConfig rpc = webMetaData.getReplicationConfig();
if (rpc != null)
- {
- replicationGranularity_ = ReplicationGranularity.fromString(rpc.getGranularity());
- invalidateSessionPolicy_ = InvalidateSessionPolicy.fromString(rpc.getTrigger());
- String useLocal = rpc.getUseLocalCache();
- useLocalCache_ = (useLocal == null || Boolean.parseBoolean(useLocal));
+ {
+ replicationTrigger_ = rpc.getReplicationTrigger();
}
maxActive_ = webMetaData.getMaxActiveSession();
PassivationConfig pConfig = webMetaData.getPassivationConfig();
@@ -216,8 +212,7 @@
}
}
- log_.debug("init(): replicationGranularity_ is " + replicationGranularity_ +
- " and invalidateSessionPolicy is " + invalidateSessionPolicy_ +
+ log_.debug("init(): replicationTrigger is " + replicationTrigger_ +
" and maxActiveSessions allowed is " + maxActive_ +
" and passivationMode is " + passivationMode_);
@@ -233,12 +228,26 @@
}
}
- public InvalidateSessionPolicy getInvalidateSessionPolicy()
+ public ReplicationTrigger getReplicationTrigger()
{
- return this.invalidateSessionPolicy_;
+ return this.replicationTrigger_;
}
/**
+ * Sets the type of operations on a <code>HttpSession</code> that
+ * trigger replication. Valid values are:
+ * <ul>
+ * <li>SET_AND_GET</li>
+ * <li>SET_AND_NON_PRIMITIVE_GET</li>
+ * <li>SET</li>
+ * </ul>
+ */
+ public void setReplicationTrigger(ReplicationTrigger trigger)
+ {
+ this.replicationTrigger_ = trigger;
+ }
+
+ /**
* Retrieve the enclosing Engine for this Manager.
*
* @return an Engine object (or null).
@@ -617,7 +626,7 @@
*/
protected void startManager() throws LifecycleException
{
- log_.info("Starting JBossManager");
+ log_.debug("Starting JBossManager");
// Validate and update our current component state
if (started_)
@@ -650,7 +659,7 @@
*/
protected void stopManager() throws LifecycleException
{
- log_.info("Stopping JBossManager");
+ log_.debug("Stopping JBossManager");
// Validate and update our current component state
if (!started_)
Deleted: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ReplicationGranularity.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ReplicationGranularity.java 2007-11-12 21:45:38 UTC (rev 66988)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ReplicationGranularity.java 2007-11-12 21:47:10 UTC (rev 66989)
@@ -1,33 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.web.tomcat.service.session;
-
-public enum ReplicationGranularity
-{
- SESSION, ATTRIBUTE, FIELD;
-
- public static ReplicationGranularity fromString(String granularity)
- {
- return (granularity == null ? SESSION
- : Enum.valueOf(ReplicationGranularity.class, granularity));
- }
-}
More information about the jboss-cvs-commits
mailing list