[jboss-cvs] JBossAS SVN: r78927 - in branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session: notification and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 29 09:21:55 EDT 2008
Author: bstansberry at jboss.com
Date: 2008-09-29 09:21:55 -0400 (Mon, 29 Sep 2008)
New Revision: 78927
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/notification/ClusteredSessionNotificationPolicy.java
branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java
Log:
[JBAS-5778] Fix method name spelling; call HttpSessionListener on failover
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-09-29 13:04:25 UTC (rev 78926)
+++ branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java 2008-09-29 13:21:55 UTC (rev 78927)
@@ -138,7 +138,7 @@
private int maxUnreplicatedInterval_ = WebMetaData.DEFAULT_MAX_UNREPLICATED_INTERVAL;
private String notificationPolicyClass_;
- private ClusteredSessionNotificationPolicy notificationPolicy_ = new LegacyClusteredSessionNotificationPolicy();
+ private ClusteredSessionNotificationPolicy notificationPolicy_;
// ---------------------------------------------------------- Constructors
@@ -181,10 +181,6 @@
}
this.notificationPolicyClass_ = webMetaData.getClusteredSessionNotificationPolicy();
- if (this.notificationPolicyClass_ == null || this.notificationPolicyClass_.length() == 0)
- {
- this.notificationPolicyClass_ = System.getProperty("jboss.web.clustered.session.notification.policy");
- }
if (proxy_ == null)
proxy_ = new JBossCacheService(cacheObjectNameString_);
@@ -835,15 +831,15 @@
log_.trace("Checking for session " + realId + " in the distributed cache");
session = loadSession(realId);
- if (session != null)
- {
- add(session);
- // We now notify, since we've added a policy to allow listeners
- // to discriminate. But the default policy will not allow the
- // notification to be emitted for FAILOVER, so the standard
- // behavior is unchanged.
- session.tellNew(ClusteredSessionNotificationCause.FAILOVER);
- }
+// if (session != null)
+// {
+// add(session);
+// // We now notify, since we've added a policy to allow listeners
+// // to discriminate. But the default policy will not allow the
+// // notification to be emitted for FAILOVER, so the standard
+// // behavior is unchanged.
+// session.tellNew(ClusteredSessionNotificationCause.FAILOVER);
+// }
}
else if (session != null && session.isOutdated())
{
@@ -1102,7 +1098,10 @@
// Need to initialize.
session.initAfterLoad(this);
if (mustAdd)
+ {
add(session, false); // don't replicate
+ session.tellNew(ClusteredSessionNotificationCause.FAILOVER);
+ }
long elapsed = System.currentTimeMillis() - begin;
stats_.updateLoadStats(realId, elapsed);
@@ -1422,7 +1421,15 @@
public void processLocalPojoModification(String realId)
{
- ClusteredSession session = findLocalSession(realId);
+ // Try to use the thread local and avoid concurrent map
+ ClusteredSession session = SessionReplicationContext.findSoleSession(realId);
+
+ if (session == null)
+ {
+ // Must be a cross context request; just use concurrent map
+ session = findLocalSession(realId);
+ }
+
if (session != null)
{
if (trace)
@@ -1717,25 +1724,28 @@
private void initClusteredSessionNotificationPolicy()
{
- if (this.notificationPolicyClass_ != null && this.notificationPolicyClass_.length() == 0)
- {
- try
- {
- this.notificationPolicy_ = (ClusteredSessionNotificationPolicy) Thread.currentThread().getContextClassLoader().loadClass(this.notificationPolicyClass_).newInstance();
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new RuntimeException("Failed to instantiate " +
- ClusteredSessionNotificationPolicy.class.getName() +
- " " + this.notificationPolicyClass_, e);
- }
-
- this.notificationPolicy_.setClusteredSessionExpriationNotificationCapability(new ClusteredSessionNotificationCapability());
+ if (this.notificationPolicyClass_ == null || this.notificationPolicyClass_.length() == 0)
+ {
+ this.notificationPolicyClass_ = System.getProperty("jboss.web.clustered.session.notification.policy",
+ LegacyClusteredSessionNotificationPolicy.class.getName());
}
+
+ try
+ {
+ this.notificationPolicy_ = (ClusteredSessionNotificationPolicy) Thread.currentThread().getContextClassLoader().loadClass(this.notificationPolicyClass_).newInstance();
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Failed to instantiate " +
+ ClusteredSessionNotificationPolicy.class.getName() +
+ " " + this.notificationPolicyClass_, e);
+ }
+
+ this.notificationPolicy_.setClusteredSessionNotificationCapability(new ClusteredSessionNotificationCapability());
}
/**
Modified: branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicy.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicy.java 2008-09-29 13:04:25 UTC (rev 78926)
+++ branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicy.java 2008-09-29 13:21:55 UTC (rev 78927)
@@ -111,5 +111,5 @@
*
* @param capability the capability, Will not be <code>null</code>.
*/
- void setClusteredSessionExpriationNotificationCapability(ClusteredSessionNotificationCapability capability);
+ void setClusteredSessionNotificationCapability(ClusteredSessionNotificationCapability capability);
}
Modified: branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java 2008-09-29 13:04:25 UTC (rev 78926)
+++ branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java 2008-09-29 13:21:55 UTC (rev 78927)
@@ -16,7 +16,7 @@
super();
}
- public void setClusteredSessionExpriationNotificationCapability(ClusteredSessionNotificationCapability capability)
+ public void setClusteredSessionNotificationCapability(ClusteredSessionNotificationCapability capability)
{
this.capability = capability;
}
More information about the jboss-cvs-commits
mailing list