[jboss-cvs] JBossAS SVN: r92708 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/session.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Aug 23 12:55:19 EDT 2009
Author: bstansberry at jboss.com
Date: 2009-08-23 12:55:19 -0400 (Sun, 23 Aug 2009)
New Revision: 92708
Modified:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java
Log:
[JBAS-7198] Replicate full session content on failover
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 2009-08-23 16:54:38 UTC (rev 92707)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java 2009-08-23 16:55:19 UTC (rev 92708)
@@ -150,6 +150,9 @@
protected static final StringManager sm =
StringManager.getManager(ClusteredSession.class.getPackage().getName());
+ /** Length of time we do full replication as workaround to JBCACHE-1531 */
+ private static final long FULL_REPLICATION_WINDOW_LENGTH = 5000;
+
// ----------------------------------------------------- Instance Variables
/**
@@ -374,6 +377,13 @@
/** True if a call to activate() is needed to offset a preceding passivate() call */
private transient boolean needsPostReplicateActivation;
+ /** True if a getOutgoingSessionData() should include metadata and all
+ * attributes no matter what. This is a workaround to JBCACHE-1531.
+ * This flag ensures that at least one request gets full replication, whether
+ * or not in occurs before this.fullReplicationWindow */
+ private transient boolean fullReplicationRequired = true;
+ /** End of period when we do full replication */
+ private transient long fullReplicationWindow = -1;
// ------------------------------------------------------------ Constructors
@@ -391,6 +401,7 @@
this.firstAccess = true;
setManager(manager);
+ requireFullReplication();
}
// ---------------------------------------------------------------- Session
@@ -1112,7 +1123,10 @@
// }
// We are no longer outdated vis a vis distributed cache
- outdatedTime = 0;
+ this.outdatedTime = 0;
+
+ // Requests must publish our full state back to the cluster in case anything got dropped.
+ this.requireFullReplication();
}
// ------------------------------------------------------------------ Public
@@ -1137,6 +1151,12 @@
sessionMetadataDirty = false;
lastReplicated = System.currentTimeMillis();
+
+ this.fullReplicationRequired = false;
+ if (this.fullReplicationWindow > 0 && System.currentTimeMillis() > this.fullReplicationWindow)
+ {
+ this.fullReplicationWindow = -1;
+ }
}
/**
@@ -1791,8 +1811,18 @@
protected boolean isSessionAttributeMapDirty()
{
- return sessionAttributesDirty;
+ return sessionAttributesDirty || isFullReplicationNeeded();
}
+
+ protected boolean isFullReplicationNeeded()
+ {
+ if (fullReplicationRequired)
+ {
+ return true;
+ }
+ return fullReplicationRequired ||
+ (fullReplicationWindow > 0 && System.currentTimeMillis() < fullReplicationWindow);
+ }
// ----------------------------------------------------------------- Private
@@ -2001,5 +2031,11 @@
manager.remove(this);
}
}
+
+ private void requireFullReplication()
+ {
+ this.fullReplicationRequired = true;
+ this.fullReplicationWindow = System.currentTimeMillis() + FULL_REPLICATION_WINDOW_LENGTH;
+ }
}
More information about the jboss-cvs-commits
mailing list