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

Manik Surtani msurtani at jboss.com
Thu Jan 4 00:35:39 EST 2007


  User: msurtani
  Date: 07/01/04 00:35:39

  Modified:    src/org/jboss/cache         Node.java VersionedNode.java
                        UnversionedNode.java CacheSPI.java CacheImpl.java
                        AbstractNode.java NodeSPI.java RegionManager.java
  Log:
  Major changes around nodes, and the way they interact with the interceptor stack.
  Also removed redundant methods in NodeSPI and removed the need for casting to NodeSPI in most cases.
  
  Revision  Changes    Path
  1.54      +2 -7      JBossCache/src/org/jboss/cache/Node.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Node.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/Node.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -b -r1.53 -r1.54
  --- Node.java	31 Dec 2006 03:01:20 -0000	1.53
  +++ Node.java	4 Jan 2007 05:35:39 -0000	1.54
  @@ -39,12 +39,12 @@
      /**
       * @return a {@link Map} containing the data in this {@link Node}.  If there is no data, an empty {@link Map} is returned.  The {@link Map} returned is always immutable.
       */
  -   Map getData();
  +   Map<Object, Object> getData();
   
      /**
       * @return a {@link Set} containing the data in this {@link Node}.  If there is no data, an empty {@link Set} is returned.  The {@link Set} returned is always immutable.
       */
  -   Set getKeys();
  +   Set<Object> getKeys();
   
      /**
       * @return The {@link Fqn} which represents the location of this {@link Node} in the cache structure.  The {@link Fqn} returned is absolute.
  @@ -155,9 +155,4 @@
       * @return Returns true if the child node denoted by the {@link Fqn} passed in exists.
       */
      boolean hasChild(Fqn f);
  -
  -   /**
  -    * Returns the service provider interface for this node.
  -    */
  -   NodeSPI getNodeSPI();
   }
  
  
  
  1.5       +4 -4      JBossCache/src/org/jboss/cache/VersionedNode.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: VersionedNode.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/VersionedNode.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- VersionedNode.java	2 Jan 2007 23:42:50 -0000	1.4
  +++ VersionedNode.java	4 Jan 2007 05:35:39 -0000	1.5
  @@ -26,9 +26,9 @@
       * node is actually disconnected from the CacheImpl itself.
       * The parent could be looked up from the TransactionWorkspace.
       */
  -   private Node parent;
  +   private NodeSPI parent;
   
  -   public VersionedNode(Object childName, Fqn fqn, Node parent, Map data, boolean mapSafe, CacheSPI cache)
  +   public VersionedNode(Object childName, Fqn fqn, NodeSPI parent, Map data, boolean mapSafe, CacheSPI cache)
      {
         super(childName, fqn, data, mapSafe, cache);
         if (parent == null && !fqn.isRoot()) throw new NullPointerException("parent");
  @@ -36,7 +36,7 @@
         this.version = DefaultDataVersion.ZERO;
      }
   
  -   public VersionedNode(Object childName, Fqn fqn, Node parent, Map data, CacheSPI cache)
  +   public VersionedNode(Object childName, Fqn fqn, NodeSPI parent, Map data, CacheSPI cache)
      {
         this(childName, fqn, parent, data, false, cache);
      }
  @@ -54,7 +54,7 @@
      /**
       * Returns the parent.
       */
  -   public Node getParent()
  +   public NodeSPI getParent()
      {
         return parent;
      }
  
  
  
  1.9       +119 -286  JBossCache/src/org/jboss/cache/UnversionedNode.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UnversionedNode.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/UnversionedNode.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- UnversionedNode.java	3 Jan 2007 15:33:09 -0000	1.8
  +++ UnversionedNode.java	4 Jan 2007 05:35:39 -0000	1.9
  @@ -9,9 +9,6 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.lock.IdentityLock;
  -import org.jboss.cache.lock.LockingException;
  -import org.jboss.cache.lock.NodeLock;
  -import org.jboss.cache.lock.TimeoutException;
   import org.jboss.cache.marshall.MethodCall;
   import org.jboss.cache.marshall.MethodCallFactory;
   import org.jboss.cache.marshall.MethodDeclarations;
  @@ -63,7 +60,7 @@
      /**
       * A reference of the CacheImpl instance.
       */
  -   private transient CacheSPI cache;
  +   private transient CacheImpl cache;
   
      /**
       * Map of general data keys to values.
  @@ -134,7 +131,7 @@
         {
            throw new IllegalArgumentException("no cache init for " + fqn);
         }
  -      this.cache = cache;
  +      this.cache = (CacheImpl) cache;
         this.fqn = fqn;
         if (!fqn.isRoot() && !child_name.equals(fqn.getLastElement()))
         {
  @@ -145,7 +142,7 @@
      /**
       * Returns a parent by checking the TreeMap by name.
       */
  -   public Node getParent()
  +   public NodeSPI getParent()
      {
         if (fqn.isRoot())
         {
  @@ -181,7 +178,7 @@
   
      public void setCache(CacheSPI cache)
      {
  -      this.cache = cache;
  +      this.cache = (CacheImpl) cache;
         this.lock_ = null;
         if (children != null)
         {
  @@ -207,27 +204,16 @@
         childrenLoaded = flag;
      }
   
  -   public synchronized Object get(Object key)
  +   public Object get(Object key)
      {
  -      if (data == null)
  -      {
  -         return null;
  -      }
  -      return data.get(key);
  +      return cache.get(getFqn(), key);
      }
   
  -   public synchronized boolean containsKey(Object key)
  +   public synchronized Object getDirect(Object key)
      {
  -      return data != null && data.containsKey(key);
  +      return data == null ? null : data.get(key);
      }
   
  -   /**
  -    * Returns the data keys, or an empty set if there are no keys.
  -    */
  -   public Set getDataKeys()
  -   {
  -      return getKeys();
  -   }
   
      private boolean isReadLocked()
      {
  @@ -245,101 +231,53 @@
         return lock_;
      }
   
  -   public synchronized Map getData()
  +   public Map<Object, Object> getData()
      {
  -      if (data == null)
  +      Map<Object, Object> dMap = new HashMap<Object, Object>();
  +      for (Object k : cache.getKeys(getFqn()))
         {
  -         return Collections.EMPTY_MAP;
  +         dMap.put(k, cache.get(fqn, k));
         }
  -      return Collections.unmodifiableMap(data);
  +      return Collections.unmodifiableMap(dMap);
      }
   
  -   protected void put(Map data, boolean erase)
  -   {
  -      if (cache.getInvocationContext().getOptionOverrides().isBypassInterceptorChain())
  -      {
  -         try
  -         {
  -            if (data == null)
  -            {
  -               return;
  -            }
  -            if (log.isTraceEnabled())
  -            {
  -               log.trace("put " + data.size() + " erase=" + erase);
  -            }
  -            synchronized (this)
  -            {
  -               if (erase)
  -               {
  -                  if (this.data != null)
  -                  {
  -                     this.data.clear();
  -                  }
  -               }
  -               data().putAll(data);
  -            }
  -         }
  -         finally
  -         {
  -            cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(false);
  -         }
  -      }
  -      else
  +   public synchronized Map<Object, Object> getDataDirect()
         {
  -         if (erase)
  -         {
  -            ((CacheImpl) cache).removeData(fqn);
  -         }
  -         cache.put(fqn, data);
  -      }
  +      return data();
      }
   
  +
      public Object put(Object key, Object value)
      {
  -      if (cache.getInvocationContext().getOptionOverrides().isBypassInterceptorChain())
  -      {
  -         Object result;
  -         try
  -         {
  -            synchronized (this)
  -            {
  -               result = data().put(key, value);
  -            }
  -         }
  -         finally
  -         {
  -            cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(false);
  -         }
  -         return result;
  -      }
  -      else
  -      {
            return cache.put(getFqn(), key, value);
         }
  +
  +   public synchronized Object putDirect(Object key, Object value)
  +   {
  +      return data().put(key, value);
      }
   
  -   public Node getOrCreateChild(Object child_name, GlobalTransaction gtx)
  +   public NodeSPI getOrCreateChild(Object child_name, GlobalTransaction gtx)
      {
         return getOrCreateChild(child_name, gtx, true);
      }
   
  -   private Node getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean createIfNotExists)
  +   private NodeSPI getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean createIfNotExists)
      {
   
  -      Node child;
  +      NodeSPI child;
         if (child_name == null)
         {
            throw new IllegalArgumentException("null child name");
         }
   
  -      child = children().get(child_name);
  +      child = (NodeSPI) children().get(child_name);
         if (createIfNotExists && child == null)
         {
            // construct the new child outside the synchronized block to avoid
            // spending any more time than necessary in the synchronized section
            Fqn child_fqn = new Fqn(this.fqn, child_name);
  -         Node newChild = cache.getConfiguration().getRuntimeConfig().getNodeFactory().createNode(child_name, this, null);
  +         NodeSPI newChild = (NodeSPI) cache.getConfiguration().getRuntimeConfig().getNodeFactory().createNode(child_name, this, null);
            if (newChild == null)
            {
               throw new IllegalStateException();
  @@ -348,7 +286,7 @@
            {
               // check again to see if the child exists
               // after acquiring exclusive lock
  -            child = children().get(child_name);
  +            child = (NodeSPI) children().get(child_name);
               if (child == null)
               {
                  cache.getNotifier().notifyNodeCreated(child_fqn, true, true);
  @@ -358,7 +296,7 @@
                  {
                     MethodCall undo_op = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, gtx,
                             child_fqn, false);
  -                  ((CacheImpl) cache).addUndoOperation(gtx, undo_op);
  +                  cache.addUndoOperation(gtx, undo_op);
                     // add the node name to the list maintained for the current tx
                     // (needed for abort/rollback of transaction)
                     // cache.addNode(gtx, child.getFqn());
  @@ -380,47 +318,15 @@
   
      }
   
  -   public Node createChild(Object child_name, Fqn fqn, Node parent)
  -   {
  -      return getOrCreateChild(child_name, null, true);
  -   }
  -
  -   public Node createChild(Object child_name, Fqn fqn, Node parent, Object key, Object value)
  -   {
  -      Node n = getOrCreateChild(child_name, null, true);
  -      n.put(key, value);
  -      return n;
  -   }
  -
      public Object remove(Object key)
      {
  -      if (cache.getInvocationContext().getOptionOverrides().isBypassInterceptorChain())
  -      {
  -         Object result;
  -         try
  -         {
  -            synchronized (this)
  -            {
  -               if (data == null)
  -               {
  -                  result = null;
  -               }
  -               else
  -               {
  -                  result = data.remove(key);
  -               }
  -            }
  -         }
  -         finally
  -         {
  -            cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(false);
  -         }
  -         return result;
  -      }
  -      else
  -      {
            return cache.remove(getFqn(), key);
         }
  +
  +   public synchronized Object removeDirect(Object key)
  +   {
  +      if (data == null) return null;
  +      return data.remove(key);
      }
   
      public void printDetails(StringBuffer sb, int indent)
  @@ -437,9 +343,13 @@
         StringBuffer sb = new StringBuffer();
         sb.append(getClass().getSimpleName());
         if (deleted)
  +      {
            sb.append(" (deleted) [ ").append(fqn);
  +      }
         else
  +      {
            sb.append("[ ").append(fqn);
  +      }
         synchronized (this)
         {
            if (data != null)
  @@ -449,7 +359,7 @@
         }
         if (children != null && !children.isEmpty())
         {
  -         sb.append(" child=").append(getChildren(false));
  +         sb.append(" child=").append(getChildrenDirect(false));
         }
         if (lock_ != null)
         {
  @@ -466,118 +376,71 @@
         return sb.toString();
      }
   
  -   public void release(Object caller)
  -   {
  -      if (lock_ != null)
  -      {
  -         if (log.isTraceEnabled())
  -         {
  -            boolean wOwner = lock_.isWriteLocked() && lock_.getWriterOwner().equals(caller);
  -            log.trace("releasing " + (wOwner ? "WL" : "RL") + ": fqn=" + fqn + ", caller=" + caller);
  -         }
  -         lock_.release(caller);
  -         if (log.isTraceEnabled())
  -         {
  -            boolean wOwner = lock_.isWriteLocked() && lock_.getWriterOwner().equals(caller);
  -            log.trace("released " + (wOwner ? "WL" : "RL") + ": fqn=" + fqn + ", caller=" + caller);
  -         }
  -      }
  -   }
  -
      public Node addChild(Fqn f)
      {
  -      if (log.isTraceEnabled())
  -      {
  -         log.trace("adding child " + f + " to " + getFqn());
  +      Fqn nf = new Fqn(getFqn(), f);
  +      cache.put(nf, null);
  +      return getChild(f);
         }
  -      if (cache.getInvocationContext().getOptionOverrides().isBypassInterceptorChain())
  -      {
  -         Node newNode = this;
  -         try
  -         {
  -            GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
   
  -            if (f.size() == 1)
  -            {
  -               newNode = getOrCreateChild(f.getLastElement(), gtx);
  -            }
  -            else
  +   public NodeSPI addChildDirect(Fqn f)
               {
  -               // recursively create children
  -               Node currentParent = this;
  -               for (Object o : f.peekElements())
  -               {
  -                  newNode = currentParent.getNodeSPI().getOrCreateChild(o, gtx);
  -                  currentParent = newNode;
  -               }
  -            }
  -         }
  -         finally
  +      if (f.size() == 1)
            {
  -            cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(false);
  -         }
  -         return newNode;
  +         GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
  +         return getOrCreateChild(f.getLastElement(), gtx);
         }
         else
         {
  -         Fqn nf = new Fqn(getFqn(), f);
  -         cache.put(nf, Collections.emptyMap());
  -         return getChild(f);
  +         throw new UnsupportedOperationException("Cannot directly create children which aren't directly under the current node.");
         }
  +
      }
   
      public void clearData()
      {
  -      if (cache.getInvocationContext().getOptionOverrides().isBypassInterceptorChain())
  -      {
  -         try
  -         {
  -            synchronized (this)
  -            {
  -               if (data != null)
  -               {
  -                  data.clear();
  -               }
  +      cache.removeData(getFqn());
               }
  -         }
  -         finally
  -         {
  -            cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(false);
  -         }
  -      }
  -      else
  +
  +   public synchronized void clearDataDirect()
         {
  -         ((CacheImpl) cache).removeData(getFqn());
  -      }
  +      if (data != null) data.clear();
      }
   
      public Node getChild(Fqn fqn)
      {
  -      if (cache.getInvocationContext().getOptionOverrides().isBypassInterceptorChain())
  -      {
  -         try
  -         {
  -            Node child = getChild(fqn.getLastElement());
  -            cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(false);
  -            return child;
  +      return cache.get(new Fqn(getFqn(), fqn));
            }
  -         finally
  +
  +   public NodeSPI getChildDirect(Fqn fqn)
            {
  -            cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(false);
  -         }
  +      if (fqn.size() == 1)
  +      {
  +         return getChildDirect(fqn.getLastElement());
         }
         else
         {
  -         return ((CacheImpl) cache).get(new Fqn(getFqn(), fqn));
  +         throw new UnsupportedOperationException("Cannot directly retrieve children which aren't directly under the current node.");
         }
      }
   
      public Set<Object> getChildrenNames()
      {
  +      return cache.getChildrenNames(getFqn());
  +   }
  +
  +   public Set<Object> getChildrenNamesDirect()
  +   {
         return new ChildrenNames();
      }
   
  -   public synchronized Set getKeys()
  +   public Set<Object> getKeys()
  +   {
  +      Set keys = cache.getKeys(getFqn());
  +      return keys == null ? Collections.emptySet() : Collections.unmodifiableSet(keys);
  +   }
  +
  +   public synchronized Set<Object> getKeysDirect()
      {
         if (data == null)
         {
  @@ -588,28 +451,25 @@
   
      public boolean hasChild(Fqn f)
      {
  -      return ((CacheImpl) cache).exists(new Fqn(getFqn(), f));
  +      return cache.exists(new Fqn(getFqn(), f));
      }
   
      public void putIfNull(Object k, Object v)
      {
  -      if (cache.get(getFqn(), k) == null)
  -      {
  -         put(k, v);
  -      }
  +      throw new UnsupportedOperationException("This operation was only added in 2.0.0 to finalise the API.  This will not be implemented till 2.1.0.");
      }
   
      public void putIfNull(Map m)
      {
  -      if (getData().isEmpty())
  -      {
  -         put(m);
  -      }
  +      throw new UnsupportedOperationException("This operation was only added in 2.0.0 to finalise the API.  This will not be implemented till 2.1.0.");
      }
   
      public void removeChild(Fqn fqn)
      {
  -      if (cache.getInvocationContext().getOptionOverrides().isBypassInterceptorChain())
  +      cache.removeNode(new Fqn(getFqn(), fqn));
  +   }
  +
  +   public synchronized void removeChildDirect(Fqn f)
         {
            if (fqn.size() == 1)
            {
  @@ -617,15 +477,7 @@
            }
            else
            {
  -            Node c = getChild(fqn);
  -            cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
  -            c.getParent().removeChild(new Fqn(fqn.getLastElement()));
  -         }
  -         cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(false);
  -      }
  -      else
  -      {
  -         cache.removeNode(new Fqn(getFqn(), fqn));
  +         throw new UnsupportedOperationException("Cannot directly remove children which aren't directly under the current node.");
         }
      }
   
  @@ -634,43 +486,20 @@
         return children();
      }
   
  -   public boolean acquire(Object caller, long lock_acquisition_timeout, NodeLock.LockType lockType) throws InterruptedException,
  -           LockingException, TimeoutException
  -   {
  -      return getLock().acquire(caller, lock_acquisition_timeout, lockType);
  -   }
  -
  -   public Set acquireAll(Object caller, long timeout, NodeLock.LockType lockType) throws LockingException, TimeoutException,
  -           InterruptedException
  -   {
  -      return getLock().acquireAll(caller, timeout, lockType);
  -   }
  -
  -   public void setChildrenMap(Map children)
  +   public void setChildrenMap(Map<Object, Node> children)
      {
         this.children = children;
      }
   
  -   public boolean hasChildren()
  -   {
  -      return children != null && children.size() > 0;
  -   }
  -
      public void put(Map data)
      {
  -      put(data, false);
  +      cache.put(fqn, data);
      }
   
  -   public void removeChild(Object child_name)
  +   public synchronized void putDirect(Map data)
      {
  -      if (children != null)
  -      {
  -         children.remove(child_name);
  -         if (log.isTraceEnabled())
  -         {
  -            log.trace(getName() + " removed child " + child_name);
  -         }
  -      }
  +      if (data == null) return;
  +      data().putAll(data);
      }
   
      public void removeChildren()
  @@ -685,13 +514,13 @@
      public void print(StringBuffer sb, int indent)
      {
         printIndent(sb, indent);
  -      sb.append(Fqn.SEPARATOR).append(getName()).append(" ").append(getData().size());
  +      sb.append(Fqn.SEPARATOR).append(getName()).append(" ").append(getDataDirect().size());
         if (children != null)
         {
            for (Node node : children.values())
            {
               sb.append("\n");
  -            node.getNodeSPI().print(sb, indent + INDENT);
  +            ((NodeSPI) node).print(sb, indent + INDENT);
            }
         }
      }
  @@ -730,7 +559,7 @@
      /**
       * Returns the name of this node.
       */
  -   public Object getName()
  +   private Object getName()
      {
         return fqn.getLastElement();
      }
  @@ -757,48 +586,57 @@
         }
   
         // process children
  -      for (Map.Entry<Object, Node> me : children.entrySet())
  +      for (Map.Entry<Object, ? extends Node> me : children.entrySet())
         {
  -         NodeSPI n = me.getValue().getNodeSPI();
  +         NodeSPI n = (NodeSPI) me.getValue();
            Fqn cfqn = new Fqn(fqn, me.getKey());
            n.setFqn(cfqn);
         }
      }
   
  -   public Node getChild(Object child_name)
  -   {
  -      if (child_name == null)
  +   public Node getChild(Object childName)
         {
  -         return null;
  -      }
  -      return children == null ? null : children.get(child_name);
  +      return cache.get(new Fqn(getFqn(), childName));
      }
   
  -   public boolean childExists(Object child_name)
  +   public synchronized NodeSPI getChildDirect(Object childName)
      {
  -      return child_name != null && children != null && children.containsKey(child_name);
  +      if (childName == null) return null;
  +      return (NodeSPI) (children == null ? null : children.get(childName));
      }
   
      public Set<Node> getChildren()
      {
  +      Set<Node> children = new HashSet<Node>();
  +      for (Object c : cache.getChildrenNames(getFqn()))
  +      {
  +         Node n = cache.get(new Fqn(getFqn(), c));
  +         if (n != null) children.add(n);
  +      }
  +      return Collections.unmodifiableSet(children);
  +   }
  +
  +   public Set<NodeSPI> getChildrenDirect()
  +   {
         // strip out deleted child nodes...
         if (children == null || children.size() == 0) return Collections.emptySet();
   
  -      Set<Node> exclDeleted = new HashSet<Node>();
  +      Set<NodeSPI> exclDeleted = new HashSet<NodeSPI>();
         for (Node n : children.values())
         {
  -         if (!((NodeSPI) n).isDeleted()) exclDeleted.add(n);
  +         NodeSPI spi = (NodeSPI) n;
  +         if (!spi.isDeleted()) exclDeleted.add(spi);
         }
         return Collections.unmodifiableSet(exclDeleted);
      }
   
  -   public Set<Node> getChildren(boolean includeMarkedForRemoval)
  +   public Set<NodeSPI> getChildrenDirect(boolean includeMarkedForRemoval)
      {
         if (includeMarkedForRemoval)
         {
            if (children != null && !children.isEmpty())
            {
  -            return Collections.unmodifiableSet(new HashSet<Node>(children.values()));
  +            return Collections.unmodifiableSet(new HashSet(children.values()));
            }
            else
            {
  @@ -807,7 +645,7 @@
         }
         else
         {
  -         return getChildren();
  +         return getChildrenDirect();
         }
      }
   
  @@ -847,7 +685,7 @@
            for (Node n : children.values())
            {
               sb.append("\n");
  -            n.getNodeSPI().printDetails(sb, indent);
  +            ((NodeSPI) n).printDetails(sb, indent);
            }
         }
      }
  @@ -868,11 +706,6 @@
         this.dataLoaded = dataLoaded;
      }
   
  -   public NodeSPI getNodeSPI()
  -   {
  -      return this;
  -   }
  -
      /**
       * Might be useful to expose; a debug feature for now.
       */
  
  
  
  1.26      +5 -0      JBossCache/src/org/jboss/cache/CacheSPI.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheSPI.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/CacheSPI.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -b -r1.25 -r1.26
  --- CacheSPI.java	3 Jan 2007 14:08:37 -0000	1.25
  +++ CacheSPI.java	4 Jan 2007 05:35:39 -0000	1.26
  @@ -35,6 +35,11 @@
   public interface CacheSPI extends Cache
   {
      /**
  +    * Overrides {@link org.jboss.cache.Cache#getRoot()} to return a NodeSPI instead of a Node.
  +    */
  +   NodeSPI getRoot();
  +
  +   /**
       * Retrieves a reference to a running {@link javax.transaction.TransactionManager}, if one is configured.
       *
       * @return a TransactionManager
  
  
  
  1.15      +79 -99    JBossCache/src/org/jboss/cache/CacheImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/CacheImpl.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -r1.14 -r1.15
  --- CacheImpl.java	3 Jan 2007 17:50:31 -0000	1.14
  +++ CacheImpl.java	4 Jan 2007 05:35:39 -0000	1.15
  @@ -99,7 +99,7 @@
    * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
    * @author Brian Stansberry
    * @author Daniel Huang (dhuang at jboss.org)
  - * @version $Id: CacheImpl.java,v 1.14 2007/01/03 17:50:31 msurtani Exp $
  + * @version $Id: CacheImpl.java,v 1.15 2007/01/04 05:35:39 msurtani Exp $
    *          <p/>
    * @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
    */
  @@ -297,7 +297,7 @@
       * Used internally by interceptors.
       * Don't use as client, this method will go away.
       */
  -   public Node getRoot()
  +   public NodeSPI getRoot()
      {
         return root;
      }
  @@ -981,7 +981,7 @@
                  log.error("getCoordinator(): Interrupted while waiting for members to be set", iex);
               }
            }
  -         return members.size() > 0 ? (Address) members.get(0) : null;
  +         return members.size() > 0 ? members.get(0) : null;
         }
      }
   
  @@ -1034,9 +1034,7 @@
         for (int i = 0; i < subtree.size(); i++)
         {
            name = subtree.get(i);
  -         getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
  -         child = (NodeSPI) parent.getChild(new Fqn(name));
  -         getInvocationContext().getOptionOverrides().setBypassInterceptorChain(false);
  +         child = parent.getChildDirect(name);
            if (child == null)
            {
               // Lock the parent, create and add the child
  @@ -1052,7 +1050,7 @@
   
               try
               {
  -               child = (NodeSPI) factory.createDataNode(name,
  +               child = factory.createDataNode(name,
                          subtree.getFqnChild(i + 1),
                          parent, null, true);
                  parent.addChild(name, child);
  @@ -1065,7 +1063,7 @@
                  }
                  try
                  {
  -                  parent.getNodeSPI().getLock().releaseAll();
  +                  parent.getLock().releaseAll();
                  }
                  catch (Throwable t)
                  {
  @@ -1166,11 +1164,11 @@
         return result;
      }
   
  -   private void removeLocksForDeadMembers(Node node,
  +   private void removeLocksForDeadMembers(NodeSPI node,
                                             Vector deadMembers)
      {
         Set deadOwners = new HashSet();
  -      NodeLock lock = node.getNodeSPI().getLock();
  +      NodeLock lock = node.getLock();
         Object owner = lock.getWriterOwner();
   
         if (isLockOwnerDead(owner, deadMembers))
  @@ -1202,7 +1200,7 @@
         }
   
         // Recursively unlock children
  -      for (Node child : node.getChildren())
  +      for (NodeSPI child : node.getChildrenDirect())
         {
            removeLocksForDeadMembers(child, deadMembers);
         }
  @@ -1292,9 +1290,9 @@
       */
      public Map _getData(Fqn fqn)
      {
  -      Node n = findNode(fqn);
  +      NodeSPI n = findNode(fqn);
         if (n == null) return null;
  -      return n.getNodeSPI().getRawData();
  +      return n.getDataDirect();
      }
   
      /**
  @@ -1325,12 +1323,12 @@
   
      public Set _getKeys(Fqn fqn) throws CacheException
      {
  -      Node n = findNode(fqn);
  +      NodeSPI n = findNode(fqn);
         if (n == null)
         {
            return null;
         }
  -      Set keys = n.getNodeSPI().getRawData().keySet();
  +      Set keys = n.getKeysDirect();
         // See http://jira.jboss.com/jira/browse/JBCACHE-551
         if (keys == null)
         {
  @@ -1372,14 +1370,14 @@
                    append(sendNodeEvent).append("\")"));
         }
         if (sendNodeEvent) notifier.notifyNodeVisited(fqn, true, true);
  -      Node n = findNode(fqn);
  +      NodeSPI n = findNode(fqn);
         if (n == null)
         {
            log.trace("node not found");
            return null;
         }
         if (sendNodeEvent) notifier.notifyNodeVisited(fqn, false, true);
  -      return n.get(key);
  +      return n.getDirect(key);
      }
   
   
  @@ -1403,11 +1401,6 @@
      }
   
   
  -   /**
  -    * added so one can get nodes internally without triggering stuff
  -    *
  -    * @deprecated This will go away.
  -    */
      public NodeSPI peek(Fqn fqn)
      {
         return findInternal(fqn, true);
  @@ -1456,7 +1449,7 @@
         for (int i = 0; i < fqnSize; i++)
         {
            Object obj = fqn.get(i);
  -         n = (NodeSPI) n.getNodeSPI().getChildrenMap().get(obj);
  +         n = n.getChildDirect(obj);
            if (n == null)
            {
               return null;
  @@ -1490,14 +1483,14 @@
       */
      public boolean exists(Fqn fqn, Object key)
      {
  -      Node n = findInternal(fqn, false);
  +      NodeSPI n = findInternal(fqn, false);
         if (n == null)
         {
            return false;
         }
         else
         {
  -         return n.getKeys().contains(key);
  +         return n.getKeysDirect().contains(key);
         }
      }
   
  @@ -1761,11 +1754,11 @@
         return retval == null ? Collections.emptySet() : Collections.unmodifiableSet(new HashSet(retval));
      }
   
  -   public Set _getChildrenNames(Fqn fqn) throws CacheException
  +   public Set<Object> _getChildrenNames(Fqn fqn) throws CacheException
      {
  -      Node n = findNode(fqn);
  +      NodeSPI n = findNode(fqn);
         if (n == null) return null;
  -      Set s = n.getChildrenNames();
  +      Set<Object> s = n.getChildrenNamesDirect();
         return s;
      }
   
  @@ -1776,18 +1769,18 @@
      {
         if (fqn == null) return false;
   
  -      Node n = root;
  +      NodeSPI n = root;
         Object obj;
         for (int i = 0; i < fqn.size(); i++)
         {
            obj = fqn.get(i);
  -         n = n.getNodeSPI().getChildrenMap().get(obj);
  +         n = n.getChildDirect(obj);
            if (n == null)
            {
               return false;
            }
         }
  -      return !n.getNodeSPI().getChildrenMap().isEmpty();
  +      return !n.getChildrenMap().isEmpty();
      }
   
      /**
  @@ -1814,11 +1807,9 @@
         }
         else
         {
  -         Map<Object, Node> children;
  -         children = root.getNodeSPI().getChildrenMap();
  -         for (Node n : children.values())
  +         for (NodeSPI n : root.getChildrenDirect())
            {
  -            n.getNodeSPI().print(sb, indent);
  +            n.print(sb, indent);
               sb.append("\n");
            }
         }
  @@ -1847,9 +1838,9 @@
         StringBuffer sb = new StringBuffer("\n");
         int indent = 0;
   
  -      for (Node n : root.getNodeSPI().getChildrenMap().values())
  +      for (NodeSPI n : root.getChildrenDirect())
         {
  -         n.getNodeSPI().getLock().printLockInfo(sb, indent);
  +         n.getLock().printLockInfo(sb, indent);
            sb.append("\n");
         }
         return sb.toString();
  @@ -1863,14 +1854,14 @@
         return numLocks(root);
      }
   
  -   private int numLocks(Node n)
  +   private int numLocks(NodeSPI n)
      {
         int num = 0;
  -      if (n.getNodeSPI().getLock().isLocked())
  +      if (n.getLock().isLocked())
         {
            num++;
         }
  -      for (Node cn : n.getNodeSPI().getChildren(true))
  +      for (NodeSPI cn : n.getChildrenDirect(true))
         {
            num += numLocks(cn);
         }
  @@ -1888,14 +1879,14 @@
         return numNodes(root) - 1;
      }
   
  -   private int numNodes(Node n)
  +   private int numNodes(NodeSPI n)
      {
         if (n == null)
         {
            return 0;
         }
         int count = 1;// for n
  -      for (Node child : n.getChildren())
  +      for (NodeSPI child : n.getChildrenDirect())
         {
            count += numNodes(child);
         }
  @@ -1910,7 +1901,7 @@
       */
      public int getNumberOfAttributes()
      {
  -      return numAttributes(getRoot());
  +      return numAttributes(root);
      }
   
      /**
  @@ -1921,19 +1912,18 @@
       */
      public int getNumberOfAttributes(Fqn fqn)
      {
  -      Node n = findNode(fqn);
  +      NodeSPI n = findNode(fqn);
         return numAttributes(n);
      }
   
  -   private int numAttributes(Node n)
  +   private int numAttributes(NodeSPI n)
      {
  -      Map<Object, Node> children = n.getNodeSPI().getChildrenMap();
         int count = 0;
  -      for (Node child : children.values())
  +      for (NodeSPI child : n.getChildrenDirect())
         {
            count += numAttributes(child);
         }
  -      count += n.getData().size();
  +      count += n.getDataDirect().size();
         return count;
      }
   
  @@ -2202,12 +2192,10 @@
            log.trace("_put(" + tx + ", \"" + fqn + "\", " + data + " undo=" + create_undo_ops + " erase=" + erase_contents + ")");
         }
   
  -      Node n = findNodeCheck(tx, fqn);
  -      Map rawData = n.getNodeSPI().getRawData();
  +      NodeSPI n = findNodeCheck(tx, fqn);
  +      Map rawData = n.getDataDirect();
         notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.PUT_MAP, rawData, true);
   
  -      getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
  -
         // create a compensating method call (reverting the effect of
         // this modification) and put it into the TX's undo list.
         if (tx != null && create_undo_ops)
  @@ -2219,8 +2207,8 @@
            tx_table.addUndoOperation(tx, undo_op);
         }
   
  -      if (erase_contents) n.clearData();
  -      n.put(data);
  +      if (erase_contents) n.clearDataDirect();
  +      n.putDirect(data);
   
         notifier.notifyNodeModified(fqn, false, CacheListener.ModificationType.PUT_MAP, rawData, true);
   
  @@ -2257,12 +2245,11 @@
            log.warn("using a map as a key in a map, did you mean to do that?");
         }
   
  -      Node n = findNodeCheck(tx, fqn);
  -      Map rawData = n.getNodeSPI().getRawData();
  +      NodeSPI n = findNodeCheck(tx, fqn);
  +      Map rawData = n.getDataDirect();
         notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.PUT_DATA, rawData, true);
   
  -      getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
  -      Object old_value = n.put(key, value);
  +      Object old_value = n.putDirect(key, value);
   
         // create a compensating method call (reverting the effect of
         // this modification) and put it into the TX's undo list.
  @@ -2341,7 +2328,7 @@
      {
   
         NodeSPI n;
  -      Node parent_node;
  +      NodeSPI parent_node;
         MethodCall undo_op = null;
   
         if (log.isTraceEnabled())
  @@ -2410,7 +2397,7 @@
         }
         else
         {
  -         notifier.notifyNodeRemoved(fqn, true, n.getNodeSPI().getRawData(), true);
  +         notifier.notifyNodeRemoved(fqn, true, n.getDataDirect(), true);
         }
   
         parent_node = n.getParent();
  @@ -2418,7 +2405,7 @@
         // remove subtree from parent
         if (eviction || configuration.isNodeLockingOptimistic())
         {
  -         parent_node.getNodeSPI().getChildrenMap().remove(n.getFqn().getLastElement());
  +         parent_node.getChildrenMap().remove(n.getFqn().getLastElement());
         }
         else
         {
  @@ -2427,7 +2414,7 @@
   
         if (eviction)
         {
  -         parent_node.getNodeSPI().setChildrenLoaded(false);
  +         parent_node.setChildrenLoaded(false);
         }
   
         // release all locks for the entire subtree
  @@ -2476,7 +2463,6 @@
      public Object _remove(GlobalTransaction tx, Fqn fqn, Object key, boolean create_undo_ops)
              throws CacheException
      {
  -      Node n = null;
         MethodCall undo_op = null;
         Object old_value = null;
   
  @@ -2487,17 +2473,16 @@
   
         // Find the node. This will lock it (if <tt>locking</tt> is true) and
         // add the temporarily created parent nodes to the TX's node list if tx != null)
  -      n = findNode(fqn);
  +      NodeSPI n = findNode(fqn);
         if (n == null)
         {
            log.warn("node " + fqn + " not found");
            return null;
         }
   
  -      notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.REMOVE_DATA, n.getNodeSPI().getRawData(), true);
  +      notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.REMOVE_DATA, n.getDataDirect(), true);
   
  -      getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
  -      old_value = n.remove(key);
  +      old_value = n.removeDirect(key);
   
         // create a compensating method call (reverting the effect of
         // this modification) and put it into the TX's undo list.
  @@ -2557,7 +2542,6 @@
      public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction, DataVersion version)
              throws CacheException
      {
  -      Node n = null;
         MethodCall undo_op = null;
   
         if (log.isTraceEnabled())
  @@ -2567,14 +2551,14 @@
   
         // Find the node. This will lock it (if <tt>locking</tt> is true) and
         // add the temporarily created parent nodes to the TX's node list if tx != null)
  -      n = findNode(fqn, version);
  +      NodeSPI n = findNode(fqn, version);
         if (n == null)
         {
            log.warn("node " + fqn + " not found");
            return;
         }
   
  -      Map data = n.getData();
  +      Map data = n.getDataDirect();
   
         // create a compensating method call (reverting the effect of
         // this modification) and put it into the TX's undo list.
  @@ -2596,11 +2580,11 @@
            notifier.notifyNodeModified(fqn, true, CacheListener.ModificationType.REMOVE_DATA, data, true);
         }
   
  -      Map raw = n.getNodeSPI().getRawData();
  +      Map raw = n.getDataDirect();
         raw.clear();
         if (eviction)
         {
  -         n.getNodeSPI().setDataLoaded(false);
  +         n.setDataLoaded(false);
         }
   
         if (sendNodeEvent)
  @@ -2852,14 +2836,14 @@
   
         // for now, perform a very simple series of getData calls.
   
  -      Node actualNode = findNode(fqn);
  +      NodeSPI actualNode = findNode(fqn);
         Fqn backupNodeFqn = null;
         if (actualNode == null && searchSubtrees)
         {
  -         Node backupSubtree = findNode(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
  +         NodeSPI backupSubtree = findNode(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
            if (backupSubtree != null)
            {
  -            Map children = backupSubtree.getNodeSPI().getChildrenMap();
  +            Map children = backupSubtree.getChildrenMap();
               if (children != null)
               {
                  Iterator childNames = children.keySet().iterator();
  @@ -2905,12 +2889,11 @@
         }
      }
   
  -   private List getNodeData(List list, Node node)
  +   private List getNodeData(List list, NodeSPI node)
      {
  -      NodeData data = new NodeData(BuddyManager.getActualFqn(node.getFqn()), node.getData());
  +      NodeData data = new NodeData(BuddyManager.getActualFqn(node.getFqn()), node.getDataDirect());
         list.add(data);
  -      Map<Object, Node> children = node.getNodeSPI().getChildrenMap();
  -      for (Node childNode : children.values())
  +      for (NodeSPI childNode : node.getChildrenDirect())
         {
            getNodeData(list, childNode);
         }
  @@ -2992,7 +2975,7 @@
       */
      public void _releaseAllLocks(Fqn fqn)
      {
  -      Node n;
  +      NodeSPI n;
   
         try
         {
  @@ -3010,13 +2993,13 @@
         }
      }
   
  -   private void releaseAll(Node n)
  +   private void releaseAll(NodeSPI n)
      {
  -      for (Node child : n.getChildren())
  +      for (NodeSPI child : n.getChildrenDirect())
         {
            releaseAll(child);
         }
  -      n.getNodeSPI().getLock().releaseAll();
  +      n.getLock().releaseAll();
      }
   
   
  @@ -3177,21 +3160,19 @@
            throw new NodeNotExistsException("New parent node " + newParentFqn + " does not exist when attempting to move node!!");
         }
   
  -      Node node = findNode(nodeToMoveFqn);
  +      NodeSPI node = findNode(nodeToMoveFqn);
   
         if (node == null)
         {
            throw new NodeNotExistsException("Node " + nodeToMoveFqn + " does not exist when attempting to move node!!");
         }
   
  -      NodeSPI oldParent = (NodeSPI) node.getParent();
  +      NodeSPI oldParent = node.getParent();
         Object nodeName = nodeToMoveFqn.getLastElement();
   
         // now that we have the parent and target nodes:
         // first correct the pointers at the pruning point
  -      getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
  -      oldParent.removeChild(new Fqn(nodeName));
  -      getInvocationContext().getOptionOverrides().setBypassInterceptorChain(false);
  +      oldParent.removeChildDirect(new Fqn(nodeName));
         newParent.addChild(nodeName, node);
   
         // parent pointer is calculated on the fly using Fqns.
  @@ -3222,10 +3203,10 @@
         //intentionally empty, used only for reflection in MethodDeclarations.unblockChannelLocal
      }
   
  -   private void moveFqns(Node node, Fqn newBase)
  +   private void moveFqns(NodeSPI node, Fqn newBase)
      {
         Fqn newFqn = new Fqn(newBase, node.getFqn().getLastElement());
  -      node.getNodeSPI().setFqn(newFqn);
  +      node.setFqn(newFqn);
      }
   
      protected class MessageListenerAdaptor implements ExtendedMessageListener
  @@ -3749,7 +3730,7 @@
         GlobalTransaction gtx = tx_table.get(tx);
         if (gtx == null && createIfNotExists)
         {
  -         Address addr = (Address) getLocalAddress();
  +         Address addr = getLocalAddress();
            gtx = GlobalTransaction.create(addr);
            tx_table.put(tx, gtx);
            TransactionEntry ent = configuration.isNodeLockingOptimistic() ? new OptimisticTransactionEntry() : new TransactionEntry();
  @@ -3869,8 +3850,7 @@
            }
            else
            {
  -            getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
  -            n.getParent().removeChild(n.getFqn());
  +            n.getParent().removeChildDirect(n.getFqn());
            }
         }
         else
  @@ -4117,7 +4097,7 @@
            Node n = get(fqn);
            if (n != null)
            {
  -            evictChildren(n);
  +            evictChildren((NodeSPI) n);
            }
         }
         else
  @@ -4126,10 +4106,10 @@
         }
      }
   
  -   private void evictChildren(Node n)
  +   private void evictChildren(NodeSPI n)
      {
  -      Set<Node> children = n.getChildren();
  -      for (Node child : children)
  +      Set<NodeSPI> children = n.getChildrenDirect();
  +      for (NodeSPI child : children)
         {
            evictChildren(child);
         }
  @@ -4150,8 +4130,8 @@
      {
         throw new UnsupportedOperationException("Not yet implemented.");
         // TODO Implement this method PROPERLY as per JBCACHE-848
  -//      getInvocationContext().getOptionOverrides().setFailSilently(true);
  -//      put(fqn, key, value);
  +      //      getInvocationContext().getOptionOverrides().setFailSilently(true);
  +      //      put(fqn, key, value);
      }
   
      public boolean isStarted()
  
  
  
  1.27      +0 -0      JBossCache/src/org/jboss/cache/AbstractNode.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  
  
  
  1.8       +153 -12   JBossCache/src/org/jboss/cache/NodeSPI.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: NodeSPI.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/NodeSPI.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- NodeSPI.java	2 Jan 2007 17:15:29 -0000	1.7
  +++ NodeSPI.java	4 Jan 2007 05:35:39 -0000	1.8
  @@ -63,20 +63,11 @@
      void setChildrenMap(Map<Object, Node> children);
   
      /**
  -    * Returns a map to access the node's data.
  -    * This data should only be modified by the cache itself.
  -    * This method should never return null.
  -    *
  -    * @return raw data map
  -    */
  -   Map<Object, Object> getRawData();
  -
  -   /**
       * Returns an existing child or creates a new one using a global transaction.
       *
       * @return newly created node
       */
  -   Node getOrCreateChild(Object name, GlobalTransaction tx);
  +   NodeSPI getOrCreateChild(Object name, GlobalTransaction tx);
   
      /**
       * Returns a lock for this node.
  @@ -112,8 +103,6 @@
   
      void addChild(Object nodeName, Node nodeToAdd);
   
  -   Set<Node> getChildren(boolean includeMarkedAsDeleted);
  -
      void printDetails(StringBuffer sb, int i);
   
      void removeChildren();
  @@ -134,4 +123,156 @@
       * @return A data version
       */
      DataVersion getVersion();
  +
  +
  +   // ------- these XXXDirect() methods work directly on the node and bypass the interceptor chain.
  +   /**
  +    * Functionally the same as {@link #getChildren()} except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    *
  +    * @return set of child nodes.
  +    * @see #getChildren()
  +    */
  +   Set<NodeSPI> getChildrenDirect();
  +
  +   /**
  +    * Retrieves children (directly), optionally including any marked as deleted.
  +    *
  +    * @param includeMarkedAsDeleted if true, even nodes marked as deleted will be returned.
  +    * @return a set of nodes
  +    */
  +   Set<NodeSPI> getChildrenDirect(boolean includeMarkedAsDeleted);
  +
  +   /**
  +    * Functionally the same as {@link #getChild(Object)} except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    *
  +    * @param childName
  +    * @return child node
  +    * @see #getChild(Object)
  +    */
  +   NodeSPI getChildDirect(Object childName);
  +
  +   /**
  +    * Functionally the same as {@link #addChild(Fqn)} except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    *
  +    * @param childName
  +    * @return child node
  +    * @see #addChild(Fqn)
  +    */
  +   NodeSPI addChildDirect(Fqn childName);
  +
  +   /**
  +    * Functionally the same as {@link #getChild(Fqn)} except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    *
  +    * @param childName
  +    * @return child node
  +    * @see #getChild(Fqn)
  +    */
  +   NodeSPI getChildDirect(Fqn childName);
  +
  +   /**
  +    * Functionally the same as {@link #removeChild(Fqn)} except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    *
  +    * @param fqn of child.
  +    * @see #removeChild(Fqn)
  +    */
  +   void removeChildDirect(Fqn fqn);
  +
  +   /**
  +    * Functionally the same as {@link #remove(Object)} except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    *
  +    * @param key to remove
  +    * @see #remove(Object)
  +    */
  +   Object removeDirect(Object key);
  +
  +   /**
  +    * Functionally the same as {@link #put(Object,Object)} except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    *
  +    * @param key   of data
  +    * @param value of data
  +    * @see #put(Object,Object)
  +    */
  +   Object putDirect(Object key, Object value);
  +
  +   /**
  +    * Functionally the same as {@link #put(Map)} except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    *
  +    * @param data to put
  +    * @see #put(Map)
  +    */
  +   void putDirect(Map<Object, Object> data);
  +
  +   /**
  +    * Functionally the same as {@link #getData()}  except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    * <p/>
  +    * Note that this returns a reference to access the node's data.
  +    * This data should only be modified by the cache itself.
  +    * This method should never return null.
  +    *
  +    * @see #getData()
  +    */
  +   Map<Object, Object> getDataDirect();
  +
  +   /**
  +    * Functionally the same as {@link #get(Object)}   except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    *
  +    * @param key data to get
  +    * @see #get(Object)
  +    */
  +   Object getDirect(Object key);
  +
  +
  +   /**
  +    * Functionally the same as {@link #clearData()}  except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    *
  +    * @see #clearData()
  +    */
  +   void clearDataDirect();
  +
  +
  +   /**
  +    * Functionally the same as {@link #getKeys()} except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    *
  +    * @return set of keys
  +    * @see #getKeys()
  +    */
  +   Set<Object> getKeysDirect();
  +
  +   /**
  +    * Functionally the same as {@link #getChildrenNames()}  except that it operates directly on the node and bypasses the
  +    * interceptor chain.
  +    *
  +    * @return set of children names
  +    * @see #getChildrenNames()
  +    */
  +   Set<Object> getChildrenNamesDirect();
  +
  +   /**
  +    * Retrieves a reference to the cache in which this Node resides.
  +    *
  +    * @return a cache
  +    */
  +   CacheSPI getCache();
  +
  +   // ----------- these methods override their corresponding methods in Node, so that the return types are NodeSPI rather than Node.
  +
  +   /**
  +    * Overrides {@link #getParent()} in {@link Node} so it returns a {@link NodeSPI} instead.  Otherwise identical.
  +    *
  +    * @return parent node
  +    * @see Node#getParent()
  +    */
  +   NodeSPI getParent();
   }
  
  
  
  1.19      +4 -4      JBossCache/src/org/jboss/cache/RegionManager.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RegionManager.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/RegionManager.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -b -r1.18 -r1.19
  --- RegionManager.java	2 Jan 2007 17:15:29 -0000	1.18
  +++ RegionManager.java	4 Jan 2007 05:35:39 -0000	1.19
  @@ -449,8 +449,8 @@
            throw new CacheException("Region " + subtreeFqn + " is already being activated/deactivated");
         }
   
  -      Node parent = null;
  -      Node subtreeRoot = null;
  +      NodeSPI parent = null;
  +      NodeSPI subtreeRoot = null;
         boolean parentLocked = false;
         boolean subtreeLocked = false;
         NodeLock parentLock = null;
  @@ -496,7 +496,7 @@
               {
                  // Acquire locks
                  Object owner = cache.getOwnerForLock();
  -               subtreeLock = subtreeRoot.getNodeSPI().getLock();
  +               subtreeLock = subtreeRoot.getLock();
                  subtreeLock.acquireAll(owner, stateFetchTimeout, NodeLock.LockType.WRITE);
                  subtreeLocked = true;
   
  @@ -504,7 +504,7 @@
                  parent = subtreeRoot.getParent();
                  if (parent != null)
                  {
  -                  parentLock = parent.getNodeSPI().getLock();
  +                  parentLock = parent.getLock();
                     parentLock.acquire(owner, stateFetchTimeout, NodeLock.LockType.WRITE);
                     parentLocked = true;
                  }
  
  
  



More information about the jboss-cvs-commits mailing list