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

Manik Surtani msurtani at jboss.com
Wed Jan 17 11:24:07 EST 2007


  User: msurtani
  Date: 07/01/17 11:24:07

  Modified:    src/org/jboss/cache/interceptors         
                        CreateIfNotExistsInterceptor.java
                        CacheLoaderInterceptor.java
                        OptimisticNodeInterceptor.java
                        PessimisticLockInterceptor.java
                        DataGravitatorInterceptor.java
                        ActivationInterceptor.java
                        OptimisticValidatorInterceptor.java
                        OptimisticCreateIfNotExistsInterceptor.java
                        PassivationInterceptor.java
  Log:
  JBCACHE-565
  
  Revision  Changes    Path
  1.25      +2 -2      JBossCache/src/org/jboss/cache/interceptors/CreateIfNotExistsInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CreateIfNotExistsInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CreateIfNotExistsInterceptor.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -b -r1.24 -r1.25
  --- CreateIfNotExistsInterceptor.java	4 Jan 2007 05:35:37 -0000	1.24
  +++ CreateIfNotExistsInterceptor.java	17 Jan 2007 16:24:06 -0000	1.25
  @@ -19,7 +19,7 @@
    * (depending on the create_if_not_exists argument)
    *
    * @author Bela Ban
  - * @version $Id: CreateIfNotExistsInterceptor.java,v 1.24 2007/01/04 05:35:37 msurtani Exp $
  + * @version $Id: CreateIfNotExistsInterceptor.java,v 1.25 2007/01/17 16:24:06 msurtani Exp $
    * @deprecated This code is not used anymore and will be removed in a future unlock
    */
   public class CreateIfNotExistsInterceptor extends Interceptor
  @@ -132,7 +132,7 @@
               {
                  addFqnToPutList(fqn, put_lock);
                  findAndBlockOnRemove(fqn, remove_lock);
  -               if (!cache.getRoot().hasChild(fqn))
  +               if (cache.peek(fqn, false) == null)
                  {
                     GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
                     if (log.isTraceEnabled())
  
  
  
  1.73      +3 -3      JBossCache/src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheLoaderInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -b -r1.72 -r1.73
  --- CacheLoaderInterceptor.java	10 Jan 2007 03:55:41 -0000	1.72
  +++ CacheLoaderInterceptor.java	17 Jan 2007 16:24:06 -0000	1.73
  @@ -28,7 +28,7 @@
    * Loads nodes that don't exist at the time of the call into memory from the CacheLoader
    *
    * @author Bela Ban
  - * @version $Id: CacheLoaderInterceptor.java,v 1.72 2007/01/10 03:55:41 msurtani Exp $
  + * @version $Id: CacheLoaderInterceptor.java,v 1.73 2007/01/17 16:24:06 msurtani Exp $
    */
   public class CacheLoaderInterceptor extends BaseCacheLoaderInterceptor implements CacheLoaderInterceptorMBean
   {
  @@ -196,7 +196,7 @@
         try
         {
   
  -         NodeSPI n = cache.peek(fqn);
  +         NodeSPI n = cache.peek(fqn, true);
   
            boolean mustLoad = mustLoad(n, key);
            if (log.isTraceEnabled())
  @@ -372,7 +372,7 @@
       */
      protected NodeSPI getNode(Fqn fqn)
      {
  -      return cache.peek(fqn);
  +      return cache.peek(fqn, true);
         //      int treeNodeSize = fqn.size();
         //
         //      // root node
  
  
  
  1.49      +1 -1      JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: OptimisticNodeInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -b -r1.48 -r1.49
  --- OptimisticNodeInterceptor.java	11 Jan 2007 12:07:29 -0000	1.48
  +++ OptimisticNodeInterceptor.java	17 Jan 2007 16:24:06 -0000	1.49
  @@ -478,7 +478,7 @@
         // if we do not have the node then we need to add it to the workspace
         if (workspaceNode == null)
         {
  -         NodeSPI node = cache.peek(fqn);
  +         NodeSPI node = cache.peek(fqn, true);
            if (node == null)
            {
               return null;// seems to happen quite a bit
  
  
  
  1.44      +4 -4      JBossCache/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PessimisticLockInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -b -r1.43 -r1.44
  --- PessimisticLockInterceptor.java	10 Jan 2007 17:47:23 -0000	1.43
  +++ PessimisticLockInterceptor.java	17 Jan 2007 16:24:06 -0000	1.44
  @@ -36,7 +36,7 @@
    * current method and unlock when the method returns.
    *
    * @author Bela Ban
  - * @version $Id: PessimisticLockInterceptor.java,v 1.43 2007/01/10 17:47:23 msurtani Exp $
  + * @version $Id: PessimisticLockInterceptor.java,v 1.44 2007/01/17 16:24:06 msurtani Exp $
    */
   public class PessimisticLockInterceptor extends Interceptor
   {
  @@ -174,7 +174,7 @@
               {
                  lock(fqn, ctx.getGlobalTransaction(), lock_type, recursive, createIfNotExists, zeroLockTimeout ? 0 : lock_acquisition_timeout, isDeleteOperation);
               }
  -            while (createIfNotExists && !cache.getRoot().hasChild(fqn));// keep trying until we have the lock (fixes concurrent remove())
  +            while (createIfNotExists && cache.peek(fqn, false) == null);// keep trying until we have the lock (fixes concurrent remove())
            }
         }
         else if (!lockNecessary)
  @@ -196,7 +196,7 @@
            //cache.getRemovedNodesMap().remove(fqn);
            //cache.peek(fqn);
            // do a REAL remove here.
  -         NodeSPI n = cache.peek(fqn);
  +         NodeSPI n = cache.peek(fqn, true);
            if (n != null)
            {
               lockManager.getLock(n).releaseAll(Thread.currentThread());
  @@ -368,7 +368,7 @@
            return true;// we're doing a remove and we've reached the PARENT node of the target to be removed.
         }
   
  -      if (!isTargetNode(currentNodeIndex, treeNodeSize) && !cache.getRoot().hasChild(new Fqn(currentFqn, targetFqn.get(currentNodeIndex + 1))))
  +      if (!isTargetNode(currentNodeIndex, treeNodeSize) && cache.peek(new Fqn(currentFqn, targetFqn.get(currentNodeIndex + 1)), false) == null)
         {
            return createIfNotExists;// we're at a node in the tree, not yet at the target node, and we need to create the next node.  So we need a WL here.
         }
  
  
  
  1.37      +4 -4      JBossCache/src/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: DataGravitatorInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/DataGravitatorInterceptor.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -b -r1.36 -r1.37
  --- DataGravitatorInterceptor.java	15 Jan 2007 16:19:10 -0000	1.36
  +++ DataGravitatorInterceptor.java	17 Jan 2007 16:24:06 -0000	1.37
  @@ -93,7 +93,7 @@
               }
               else
               {
  -               if (!cache.getRoot().hasChild(fqn))
  +               if (cache.peek(fqn, false) == null)
                  {
                     BackupData data;
   
  @@ -385,7 +385,7 @@
            NodeData data = (NodeData) nodes.next();
            if (localOnly)
            {
  -            if (!cache.getRoot().hasChild(data.getFqn()))
  +            if (cache.peek(data.getFqn(), false) == null)
               {
                  createNodes(data.getFqn(), data.getAttributes());
               }
  @@ -442,7 +442,7 @@
         for (Node node : getBackupRootCollection())
         {
            Fqn newSearchFqn = new Fqn(node.getFqn(), fqn);
  -         exists = cache.getRoot().hasChild(newSearchFqn);
  +         exists = cache.peek(newSearchFqn, false) != null;
            if (exists) break;
         }
   
  @@ -479,7 +479,7 @@
   
      private Collection<Node> getBackupRootCollection()
      {
  -      NodeSPI backupRoot = cache.peek(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
  +      NodeSPI backupRoot = cache.peek(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, true);
         return backupRoot == null ? Collections.EMPTY_SET : backupRoot.getChildrenDirect();
      }
   
  
  
  
  1.49      +3 -3      JBossCache/src/org/jboss/cache/interceptors/ActivationInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ActivationInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/ActivationInterceptor.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -b -r1.48 -r1.49
  --- ActivationInterceptor.java	4 Jan 2007 05:35:37 -0000	1.48
  +++ ActivationInterceptor.java	17 Jan 2007 16:24:06 -0000	1.49
  @@ -25,7 +25,7 @@
    * their attributes have been initialized and their children have been loaded in memory.
    *
    * @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
  - * @version $Id: ActivationInterceptor.java,v 1.48 2007/01/04 05:35:37 msurtani Exp $
  + * @version $Id: ActivationInterceptor.java,v 1.49 2007/01/17 16:24:06 msurtani Exp $
    */
   public class ActivationInterceptor extends CacheLoaderInterceptor implements ActivationInterceptorMBean
   {
  @@ -151,7 +151,7 @@
                  log.trace("This is a remove data operation; removing the data from the loader, no activation processing needed.");
                  loader.removeData(fqn);
               }
  -            else if (cache.getRoot().hasChild(fqn) && loader.exists(fqn))
  +            else if (cache.peek(fqn, false) != null && loader.exists(fqn))
               {
                  // Remove the node from the cache loader if it exists in memory,
                  // its attributes have been initialized, its children have been loaded,
  @@ -305,7 +305,7 @@
                  // AND it was found in the cache loader (nodeLoaded = true).
                  // Then notify the listeners that the node has been activated.
                  Fqn fqn = (Fqn) args[1];
  -               if (fqn != null && cache.getRoot().hasChild(fqn) && loader.exists(fqn))
  +               if (fqn != null && cache.peek(fqn, false) != null && loader.exists(fqn))
                  {
                     NodeSPI n = getNode(fqn);// don't load
                     // node not null and attributes have been loaded?
  
  
  
  1.54      +1 -1      JBossCache/src/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: OptimisticValidatorInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -b -r1.53 -r1.54
  --- OptimisticValidatorInterceptor.java	10 Jan 2007 03:55:41 -0000	1.53
  +++ OptimisticValidatorInterceptor.java	17 Jan 2007 16:24:06 -0000	1.54
  @@ -109,7 +109,7 @@
            if (trace) log.trace("Validating version for node " + fqn);
   
            NodeSPI realNode;
  -         realNode = cache.peek(fqn);
  +         realNode = cache.peek(fqn, true);
   
            // if this is a newly created node then we expect the underlying node to be null.
            // if not, we have a problem...
  
  
  
  1.42      +3 -3      JBossCache/src/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: OptimisticCreateIfNotExistsInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -b -r1.41 -r1.42
  --- OptimisticCreateIfNotExistsInterceptor.java	11 Jan 2007 12:07:29 -0000	1.41
  +++ OptimisticCreateIfNotExistsInterceptor.java	17 Jan 2007 16:24:06 -0000	1.42
  @@ -50,7 +50,7 @@
            Object[] args = m.getArgs();
            Fqn fqn = (Fqn) (args != null ? args[1] : null);
   
  -         if (!cache.getRoot().hasChild(fqn))
  +         if (cache.peek(fqn, false) == null)
            {
               createNode(fqn, false);
            }
  @@ -70,7 +70,7 @@
         fqns.add(newParent);
   
         //  peek into Node and get a hold of all child fqns as these need to be in the workspace.
  -      NodeSPI node = cache.peek(nodeFqn);
  +      NodeSPI node = cache.peek(nodeFqn, true);
         greedyGetFqns(fqns, node, newParent);
   
   
  @@ -79,7 +79,7 @@
   
         for (Fqn f : fqns)
         {
  -         if (!cache.getRoot().hasChild(f)) createNode(f, true);
  +         if (cache.peek(f, false) == null) createNode(f, true);
         }
      }
   
  
  
  
  1.40      +2 -2      JBossCache/src/org/jboss/cache/interceptors/PassivationInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PassivationInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/PassivationInterceptor.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -b -r1.39 -r1.40
  --- PassivationInterceptor.java	4 Jan 2007 05:35:37 -0000	1.39
  +++ PassivationInterceptor.java	17 Jan 2007 16:24:06 -0000	1.40
  @@ -16,7 +16,7 @@
    * CacheLoader, either before each method call (no TXs), or at TX commit.
    *
    * @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
  - * @version $Id: PassivationInterceptor.java,v 1.39 2007/01/04 05:35:37 msurtani Exp $
  + * @version $Id: PassivationInterceptor.java,v 1.40 2007/01/17 16:24:06 msurtani Exp $
    */
   public class PassivationInterceptor extends Interceptor implements PassivationInterceptorMBean
   {
  @@ -106,7 +106,7 @@
         {
            throw new NodeNotLoadedException();
         }
  -      NodeSPI n = cache.peek(fqn);
  +      NodeSPI n = cache.peek(fqn, true);
   
         if (n != null)
         {
  
  
  



More information about the jboss-cvs-commits mailing list