[jboss-cvs] JBossCache/src-50/org/jboss/cache/pojo ...
Brian Stansberry
brian.stansberry at jboss.com
Thu Jul 20 17:58:22 EDT 2006
User: bstansberry
Date: 06/07/20 17:58:22
Modified: src-50/org/jboss/cache/pojo PojoTreeCache.java
Log:
[JBCACHE-465] Extract the state transfer code out of TreeCache
Revision Changes Path
1.12 +3 -88 JBossCache/src-50/org/jboss/cache/pojo/PojoTreeCache.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PojoTreeCache.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/PojoTreeCache.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- PojoTreeCache.java 20 Jul 2006 18:43:12 -0000 1.11
+++ PojoTreeCache.java 20 Jul 2006 21:58:22 -0000 1.12
@@ -11,6 +11,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.RegionNotEmptyException;
import org.jboss.cache.TreeCache;
+import org.jboss.cache.aop.statetransfer.PojoStateTransferManager;
import org.jboss.cache.marshall.Region;
import org.jboss.cache.marshall.RegionNameConflictException;
import org.jboss.cache.pojo.eviction.AopEvictionPolicy;
@@ -48,6 +49,8 @@
@Override
public void startService() throws Exception
{
+ // Replace the default state transfer manager
+ setStateTransferManager(new PojoStateTransferManager(this));
super.startService();
parseConfig();
}
@@ -225,94 +228,6 @@
}
}
- /**
- * Overrides the superclass version by additionally acquiring locks
- * on the internal reference map nodes used for tracking shared objects.
- */
- @Override
- protected void acquireLocksForStateTransfer(DataNode root,
- Object lockOwner,
- long timeout,
- boolean lockChildren,
- boolean force)
- throws Exception
- {
- super.acquireLocksForStateTransfer(root, lockOwner, timeout, true, force);
- Fqn fqn = root.getFqn();
- if (fqn.size() > 0 &&
- !fqn.isChildOf(InternalConstant.JBOSS_INTERNAL))
- {
- DataNode refMapNode = get(InternalConstant.JBOSS_INTERNAL_MAP);
- if (refMapNode != null)
- {
-
- // Lock the internal map node but not its children to
- // prevent the addition of other children
- super.acquireLocksForStateTransfer(refMapNode, lockOwner, timeout,
- false, force);
-
- // Walk through the children, and lock any whose name starts
- // with the string version of our root node's Fqn
- Map children = refMapNode.getChildren();
- if (children != null)
- {
-
- String targetFqn = ObjectUtil.getIndirectFqn(fqn);
-
- Map.Entry entry;
- for (Iterator iter = children.entrySet().iterator();
- iter.hasNext();)
- {
- entry = (Map.Entry) iter.next();
- if (((String) entry.getKey()).startsWith(targetFqn))
- {
- super.acquireLocksForStateTransfer((DataNode) entry.getValue(),
- lockOwner, timeout,
- false, force);
- }
- }
- }
- }
- }
- }
-
- /**
- * Overrides the superclass version by additionally releasing locks
- * on the internal reference map nodes used for tracking shared objects.
- */
- @Override
- protected void releaseStateTransferLocks(DataNode root, Object lockOwner, boolean lokcChildren)
- {
- boolean releaseInternal = true;
- try
- {
- super.releaseStateTransferLocks(root, lockOwner, true);
- Fqn fqn = root.getFqn();
- releaseInternal = (fqn.size() > 0 &&
- !fqn.isChildOf(InternalConstant.JBOSS_INTERNAL));
- }
- finally
- {
- if (releaseInternal)
- {
- try
- {
- DataNode refMapNode = get(InternalConstant.JBOSS_INTERNAL_MAP);
- if (refMapNode != null)
- {
- // Rather than going to the effort of identifying which
- // child nodes we locked before, just release all children
- super.releaseStateTransferLocks(refMapNode, lockOwner, true);
- }
- }
- catch (CacheException ce)
- {
- log.error("Caught exception releasing locks on internal RefMap", ce);
- }
- }
- }
- }
-
public Object getLockOwner()
{
return getOwnerForLock();
More information about the jboss-cvs-commits
mailing list