[jboss-cvs] JBossCache/src/org/jboss/cache/aop ...

Brian Stansberry brian.stansberry at jboss.com
Thu Jul 20 17:58:21 EDT 2006


  User: bstansberry
  Date: 06/07/20 17:58:21

  Modified:    src/org/jboss/cache/aop  PojoCache.java
  Log:
  [JBCACHE-465] Extract the state transfer code out of TreeCache
  
  Revision  Changes    Path
  1.28      +3 -88     JBossCache/src/org/jboss/cache/aop/PojoCache.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PojoCache.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/aop/PojoCache.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -b -r1.27 -r1.28
  --- PojoCache.java	19 Jul 2006 21:34:43 -0000	1.27
  +++ PojoCache.java	20 Jul 2006 21:58:21 -0000	1.28
  @@ -9,7 +9,7 @@
   import org.jboss.cache.xml.XmlHelper;
   import org.jboss.cache.lock.UpgradeException;
   import org.jboss.cache.aop.eviction.AopEvictionPolicy;
  -import org.jboss.cache.aop.util.ObjectUtil;
  +import org.jboss.cache.aop.statetransfer.PojoStateTransferManager;
   import org.jboss.cache.marshall.Region;
   import org.jboss.cache.marshall.RegionNameConflictException;
   import org.jboss.cache.marshall.ObjectSerializationFactory;
  @@ -18,7 +18,6 @@
   import org.jboss.cache.Fqn;
   import org.jboss.cache.CacheException;
   import org.jboss.cache.RegionNotEmptyException;
  -import org.jboss.cache.DataNode;
   import org.jboss.cache.NodeImpl;
   import org.jboss.aop.InstanceAdvisor;
   import org.jgroups.JChannel;
  @@ -29,7 +28,6 @@
   import javax.transaction.TransactionManager;
   import javax.transaction.RollbackException;
   import javax.transaction.Transaction;
  -import java.util.Iterator;
   import java.util.Map;
   import java.util.WeakHashMap;
   import java.util.List;
  @@ -93,6 +91,8 @@
   
      public void startService() throws Exception
      {
  +      // Replace the default state transfer manager
  +      setStateTransferManager(new PojoStateTransferManager(this));
         super.startService();
         parseConfig();
      }
  @@ -299,91 +299,6 @@
      }
   
      /**
  -    * Overrides the superclass version by additionally acquiring locks
  -    * on the internal reference map nodes used for tracking shared objects.
  -    */
  -   protected void acquireLocksForStateTransfer(DataNode root,
  -                                               Object lockOwner,
  -                                               long timeout,
  -                                               boolean force)
  -         throws Exception
  -   {
  -      super.acquireLocksForStateTransfer(root, lockOwner, timeout, true, force);
  -      Fqn fqn = root.getFqn();
  -      if (fqn.size() > 0 &&
  -            !fqn.isChildOf(InternalDelegate.JBOSS_INTERNAL))
  -      {
  -         DataNode refMapNode = get(InternalDelegate.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.
  -    */
  -   protected void releaseStateTransferLocks(DataNode root, Object lockOwner)
  -   {
  -      boolean releaseInternal = true;
  -      try
  -      {
  -         super.releaseStateTransferLocks(root, lockOwner, true);
  -         Fqn fqn = root.getFqn();
  -         releaseInternal = (fqn.size() > 0 &&
  -               !fqn.isChildOf(InternalDelegate.JBOSS_INTERNAL));
  -      }
  -      finally
  -      {
  -         if (releaseInternal)
  -         {
  -            try
  -            {
  -               DataNode refMapNode = get(InternalDelegate.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);
  -            }
  -         }
  -      }
  -   }
  -
  -   /**
       * Obtain a cache aop type for user to traverse the defined "primitive" types in aop.
       * Note that this is not a synchronized call now for speed optimization.
       *
  
  
  



More information about the jboss-cvs-commits mailing list