[jboss-cvs] JBossAS SVN: r64877 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/session.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Aug 25 10:28:55 EDT 2007
Author: bstansberry at jboss.com
Date: 2007-08-25 10:28:55 -0400 (Sat, 25 Aug 2007)
New Revision: 64877
Modified:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheService.java
Log:
Handle PojoCacheDetachedException
Expose some static methods to unit tests
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheService.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheService.java 2007-08-25 06:39:46 UTC (rev 64876)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheService.java 2007-08-25 14:28:55 UTC (rev 64877)
@@ -49,6 +49,7 @@
import org.jboss.cache.Node;
import org.jboss.cache.Region;
import org.jboss.cache.pojo.PojoCache;
+import org.jboss.cache.pojo.PojoCacheAlreadyDetachedException;
import org.jboss.cache.pojo.jmx.PojoCacheJmxWrapperMBean;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.config.CacheLoaderConfig;
@@ -910,7 +911,22 @@
}
Subject subject = (Subject)pojo;
- subject.removeObserver(session);
+ try
+ {
+ subject.removeObserver(session);
+ }
+ catch (PojoCacheAlreadyDetachedException e)
+ {
+ // We've hit a stale pojo; can't continue further
+ // This will regularly happen when we handle notifications
+ // of remote attribute removals and remote invalidations
+ if(log_.isTraceEnabled())
+ {
+ log_.trace("removeObserver(): found detached in session: " +session + " pojo name: " +pojo.getClass().getName());
+ }
+ return;
+ }
+
if(log_.isTraceEnabled())
{
log_.trace("removeObserver(): session: " +session + " pojo name: " +pojo.getClass().getName());
@@ -957,6 +973,17 @@
removeObserver(session, value, stack);
break;
}
+ catch (PojoCacheAlreadyDetachedException e)
+ {
+ // We've hit a stale proxy; can't continue further
+ // This will regularly happen when we handle notifications
+ // of remote attribute removals and remote invalidations
+ if(log_.isTraceEnabled())
+ {
+ log_.trace("removeObserver(): found detached pojo in field " + field.getName() + " in object graph under session: " +session + " pojo name: " +pojo.getClass().getName());
+ }
+ break;
+ }
catch(IllegalAccessException e)
{
throw new RuntimeException("field access failed", e);
@@ -985,19 +1012,23 @@
private Fqn getFieldFqn(String id, String key)
{
- // /SESSION/id/ATTR/key
- // Guard against string with delimiter.
+ return getFieldFqn(hostName_, webAppPath_, id, key);
+ }
+
+ public static Fqn getFieldFqn(String hostName, String contextPath, String sessionId, String attributeKey)
+ {
List list = new ArrayList(6);
list.add(SESSION);
- list.add(hostName_);
- list.add(webAppPath_);
- list.add(id);
+ list.add(hostName);
+ list.add(contextPath);
+ list.add(sessionId);
list.add(ATTRIBUTE);
- breakKeys(key, list);
- return new Fqn(list);
+ // Guard against string with delimiter.
+ breakKeys(attributeKey, list);
+ return new Fqn(list);
}
- private void breakKeys(String key, List list)
+ private static void breakKeys(String key, List list)
{
StringTokenizer token = new StringTokenizer(key, FQN_DELIMITER);
while(token.hasMoreTokens())
@@ -1015,22 +1046,34 @@
private Fqn getSessionFqn(String id)
{
- // /SESSION/hostname/webAppPath/id
- Object[] objs = new Object[]{SESSION, hostName_, webAppPath_, id};
+ return getSessionFqn(hostName_, webAppPath_, id);
+ }
+
+ public static Fqn getSessionFqn(String hostname, String contextPath, String sessionId)
+ {
+ Object[] objs = new Object[]{SESSION, hostname, contextPath, sessionId};
return new Fqn(objs);
}
private Fqn getSessionFqn(String id, String dataOwner)
{
- // /_BUDDY_BACKUP_/dataOwner/SESSION/hostname/webAppPath/id
- Object[] objs = new Object[]{BUDDY_BACKUP, dataOwner, SESSION, hostName_, webAppPath_, id};
+ return getSessionFqn(dataOwner, hostName_, webAppPath_, id);
+ }
+
+ public static Fqn getSessionFqn(String dataOwner, String hostname, String contextPath, String sessionId)
+ {
+ Object[] objs = new Object[]{BUDDY_BACKUP, dataOwner, SESSION, hostname, contextPath, sessionId};
return new Fqn(objs);
}
private Fqn getAttributeFqn(String id)
{
- // /SESSION/hostName/webAppPath/id/ATTR
- Object[] objs = new Object[]{SESSION, hostName_, webAppPath_, id, ATTRIBUTE};
+ return getAttributeFqn(hostName_, webAppPath_, id);
+ }
+
+ public static Fqn getAttributeFqn(String hostname, String contextPath, String sessionId)
+ {
+ Object[] objs = new Object[]{SESSION, hostname, contextPath, sessionId, ATTRIBUTE};
return new Fqn(objs);
}
More information about the jboss-cvs-commits
mailing list