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

Manik Surtani msurtani at belmont.prod.atl2.jboss.com
Wed Aug 30 13:08:19 EDT 2006


  User: msurtani
  Date: 06/08/30 13:08:19

  Modified:    src/org/jboss/cache     Fqn.java NodeImpl.java
                        TreeCache.java TreeCacheProxyImpl.java
  Log:
  Java5 optimisations
  
  Revision  Changes    Path
  1.37      +130 -94   JBossCache/src/org/jboss/cache/Fqn.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Fqn.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/Fqn.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -b -r1.36 -r1.37
  --- Fqn.java	22 Aug 2006 13:42:43 -0000	1.36
  +++ Fqn.java	30 Aug 2006 17:08:19 -0000	1.37
  @@ -7,8 +7,8 @@
   package org.jboss.cache;
   
   
  -import org.apache.commons.logging.LogFactory;
   import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   
   import java.io.Externalizable;
   import java.io.IOException;
  @@ -26,23 +26,25 @@
   /**
    * Fully qualified name.  A list of relatives names, which can be any Object,
    * from root to a given node.  This class is immutable.
  - * <p />
  + * <p/>
    * Note that<br>
  - * <p />
  + * <p/>
    * <code>Fqn f = new Fqn("/a/b/c");</code>
  - * <p />
  + * <p/>
    * is <b>not</b> the same as
  - * <p />
  + * <p/>
    * <code>Fqn f = Fqn.fromString("/a/b/c");</code>
  - * <p />
  + * <p/>
    * The former will result in a single Fqn, called "/a/b/c" which hangs directly under Fqn.ROOT.
  - * <p />
  + * <p/>
    * The latter will result in 3 Fqns, called "a", "b" and "c", where "c" is a child of "b", "b" is a child of "a", and "a" hangs off Fqn.ROOT.
  - * <p />
  + * <p/>
    * Another way to look at it is that the "/" separarator is only parsed when it form sa  part of a String passed in to Fqn.fromString() and not otherwise.
  - * @version $Revision: 1.36 $
  + *
  + * @version $Revision: 1.37 $
    */
  -public class Fqn implements Cloneable, Externalizable {
  +public class Fqn implements Cloneable, Externalizable
  +{
   
      /**
       * Separator between FQN elements.
  @@ -50,7 +52,7 @@
      public static final String SEPARATOR = "/";
   
      private List elements;
  -   private transient int hash_code=0;
  +   private transient int hash_code = 0;
   
      /**
       * Controls the implementation of read/writeExternal.
  @@ -102,23 +104,27 @@
       /**
        * Constructs a root FQN.
        */
  -    public Fqn() {
  +   public Fqn()
  +   {
          elements = Collections.EMPTY_LIST;
       }
   
      /**
       * Constructs a single element Fqn.  Note that if a String is passed in, separator characters {@link #SEPARATOR} are <b>not</b> parsed.
       * If you wish these to be parsed, use {@link #fromString(String)}.
  +    *
       * @see #fromString(String)
       */
  -   public Fqn(Object name) {
  +   public Fqn(Object name)
  +   {
         elements = Collections.singletonList(name);
      }
   
      /**
       * Constructs a FQN from a list of names.
       */
  -   public Fqn(List names) {
  +   public Fqn(List names)
  +   {
         if (names != null)
            elements = new ArrayList(names);
         else
  @@ -128,10 +134,12 @@
      /**
       * Constructs a FQN from an array of names.
       */
  -   public Fqn(Object[] names) {
  +   public Fqn(Object[] names)
  +   {
         if (names == null)
            elements = Collections.EMPTY_LIST;
  -      else {
  +      else
  +      {
            elements = Arrays.asList(names);
         }
      }
  @@ -139,7 +147,8 @@
      /**
       * Constructs a FQN from a base and relative name.
       */
  -   public Fqn(Fqn base, Object relative_name) {
  +   public Fqn(Fqn base, Object relative_name)
  +   {
         elements = new ArrayList(base.elements.size() + 1);
         elements.addAll(base.elements);
         elements.add(relative_name);
  @@ -148,14 +157,16 @@
      /**
       * Constructs a FQN from a base and relative FQN.
       */
  -   public Fqn(Fqn base, Fqn relative) {
  +   public Fqn(Fqn base, Fqn relative)
  +   {
         this(base, relative.elements);
      }
   
      /**
       * Constructs a FQN from a base and a list of relative names.
       */
  -   public Fqn(Fqn base, List relative) {
  +   public Fqn(Fqn base, List relative)
  +   {
         elements = new ArrayList(base.elements.size() + relative.size());
         elements.addAll(base.elements);
         elements.addAll(relative);
  @@ -164,7 +175,8 @@
      /**
       * Constructs a FQN from a base and two relative names.
       */
  -   public Fqn(Fqn base, Object relative_name1, Object relative_name2) {
  +   public Fqn(Fqn base, Object relative_name1, Object relative_name2)
  +   {
         elements = new ArrayList(base.elements.size() + 2);
         elements.addAll(base.elements);
         elements.add(relative_name1);
  @@ -174,7 +186,8 @@
      /**
       * Constructs a FQN from a base and three relative names.
       */
  -   public Fqn(Fqn base, Object relative_name1, Object relative_name2, Object relative_name3) {
  +   public Fqn(Fqn base, Object relative_name1, Object relative_name2, Object relative_name3)
  +   {
         elements = new ArrayList(base.elements.size() + 3);
         elements.addAll(base.elements);
         elements.add(relative_name1);
  @@ -186,7 +199,8 @@
       * Construct from an unmodifiable list.
       * For internal use.
       */
  -   private static Fqn createFqn(List list) {
  +   private static Fqn createFqn(List list)
  +   {
         Fqn fqn = new Fqn();
         fqn.elements = list;
         return fqn;
  @@ -211,16 +225,19 @@
       * @see #Fqn(Object[])
       * @see #Fqn(Object)
       */
  -   public static Fqn fromString(String fqn) {
  +   public static Fqn fromString(String fqn)
  +   {
         if (fqn == null)
            return ROOT;
         return createFqn(parse(fqn));
      }
   
  -   private static List parse(String fqn) {
  +   private static List parse(String fqn)
  +   {
         List list = new ArrayList();
         StringTokenizer tok = new StringTokenizer(fqn, SEPARATOR);
  -      while (tok.hasMoreTokens()) {
  +      while (tok.hasMoreTokens())
  +      {
            list.add(tok.nextToken());
         }
         return list;
  @@ -232,7 +249,8 @@
       * @param index where is the last index of child fqn
       * @return A Fqn child object.
       */
  -   public Fqn getFqnChild(int index) {
  +   public Fqn getFqnChild(int index)
  +   {
         return createFqn(elements.subList(0, index));
      }
   
  @@ -248,22 +266,26 @@
       * Returns the number of elements in the FQN.
       * The root node contains zero.
       */
  -   public int size() {
  +   public int size()
  +   {
         return elements.size();
      }
   
      /**
       * Returns the Nth element in the FQN.
       */
  -   public Object get(int index) {
  +   public Object get(int index)
  +   {
         return elements.get(index);
      }
   
      /**
       * Returns the last element in the FQN.
  +    *
       * @see #getName
       */
  -   public Object getLast() {
  +   public Object getLast()
  +   {
         if (isRoot()) return SEPARATOR;
         return elements.get(elements.size() - 1);
      }
  @@ -271,7 +293,8 @@
      /**
       * Returns true if the FQN contains this element.
       */
  -   public boolean hasElement(Object o) {
  +   public boolean hasElement(Object o)
  +   {
         return elements.lastIndexOf(o) != -1;
      }
   
  @@ -294,21 +317,24 @@
      /**
       * Returns true if obj is a FQN with the same elements.
       */
  -   public boolean equals(Object obj) {
  +   public boolean equals(Object obj)
  +   {
         if (this == obj)
            return true;
  -      if(!(obj instanceof Fqn))
  +      if (!(obj instanceof Fqn))
            return false;
  -      Fqn other=(Fqn)obj;
  +      Fqn other = (Fqn) obj;
         return elements.equals(other.elements);
      }
   
      /**
       * Returns a hash code with FQN elements.
       */
  -   public int hashCode() {
  -      if (hash_code == 0) {
  -         hash_code=_hashCode();
  +   public int hashCode()
  +   {
  +      if (hash_code == 0)
  +      {
  +         hash_code = _hashCode();
         }
         return hash_code;
      }
  @@ -318,10 +344,10 @@
       * joining each subsequent element with a /.
       * If this is the root FQN, returns {@link Fqn#SEPARATOR}.
       * Example:
  -    <pre>
  -    new Fqn(new Object[] { "a", "b", "c" }).toString(); // "/a/b/c"
  -    Fqn.ROOT.toString(); // "/"
  -    </pre>
  +    * <pre>
  +    * new Fqn(new Object[] { "a", "b", "c" }).toString(); // "/a/b/c"
  +    * Fqn.ROOT.toString(); // "/"
  +    * </pre>
       */
      public String toString()
      {
  @@ -334,7 +360,8 @@
         return sb.toString();
      }
   
  -   public void writeExternal(ObjectOutput out) throws IOException {
  +   public void writeExternal(ObjectOutput out) throws IOException
  +   {
   
   	  if (REL_123_COMPATIBLE)
   	  {
  @@ -344,24 +371,27 @@
   	  {
            out.writeShort(elements.size());
            Object element;
  -         for(Iterator it=elements.iterator(); it.hasNext();) {
  -            element=it.next();
  +         for (Iterator it = elements.iterator(); it.hasNext();)
  +         {
  +            element = it.next();
               out.writeObject(element);
            }
   	  }
      }
   
  -   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  +   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
  +   {
   
         if (REL_123_COMPATIBLE)
         {
  -         elements=(List)in.readObject();
  +         elements = (List) in.readObject();
         }
         else
         {
            short length = in.readShort();
            this.elements = new ArrayList(length);
  -         for (int i=0; i < length; i++) {
  +         for (int i = 0; i < length; i++)
  +         {
               elements.add(in.readObject());
            }
         }
  @@ -374,7 +404,8 @@
       * @param parentFqn
       * @return true if the target is a child of parentFqn
       */
  -   public boolean isChildOf(Fqn parentFqn) {
  +   public boolean isChildOf(Fqn parentFqn)
  +   {
         if (parentFqn.elements.size() == elements.size())
            return false;
         return isChildOrEquals(parentFqn);
  @@ -383,11 +414,13 @@
      /**
       * Returns true if this fqn is equals or the child of parentFqn.
       */
  -   public boolean isChildOrEquals(Fqn parentFqn) {
  +   public boolean isChildOrEquals(Fqn parentFqn)
  +   {
         List parentList = parentFqn.elements;
         if (parentList.size() > elements.size())
            return false;
  -      for (int i = parentList.size() - 1; i >= 0; i--) {
  +      for (int i = parentList.size() - 1; i >= 0; i--)
  +      {
            if (!parentList.get(i).equals(elements.get(i)))
               return false;
         }
  @@ -397,11 +430,13 @@
      /**
       * Calculates a hash code by summing the hash code of all elements.
       */
  -   private int _hashCode() {
  +   private int _hashCode()
  +   {
         int hashCode = 0;
         int count = 1;
         Object o;
  -      for (Iterator it=elements.iterator(); it.hasNext();) {
  +      for (Iterator it = elements.iterator(); it.hasNext();)
  +      {
            o = it.next();
            hashCode += (o == null) ? 0 : o.hashCode() * count++;
         }
  @@ -446,10 +481,11 @@
      /**
       * Peeks into the elements that build up this Fqn.  The list returned is
       * read-only, to maintain the immutable nature of Fqn.
  +    *
       * @return an unmodifiable list
       */
      public List peekElements()
      {
  -       return Collections.unmodifiableList( elements );
  +      return Collections.unmodifiableList(elements);
      }
   }
  \ No newline at end of file
  
  
  
  1.8       +1 -2      JBossCache/src/org/jboss/cache/NodeImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: NodeImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/NodeImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- NodeImpl.java	25 Aug 2006 16:30:46 -0000	1.7
  +++ NodeImpl.java	30 Aug 2006 17:08:19 -0000	1.8
  @@ -329,8 +329,7 @@
                  children.put(child_name, child);
                  if (gtx != null)
                  {
  -                  MethodCall undo_op = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal,
  -                          new Object[]{gtx, child_fqn, Boolean.FALSE});
  +                  MethodCall undo_op = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, gtx, child_fqn, false);
                     cache.addUndoOperation(gtx, undo_op);
                     // add the node name to the list maintained for the current tx
                     // (needed for abort/rollback of transaction)
  
  
  
  1.234     +77 -76    JBossCache/src/org/jboss/cache/TreeCache.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCache.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeCache.java,v
  retrieving revision 1.233
  retrieving revision 1.234
  diff -u -b -r1.233 -r1.234
  --- TreeCache.java	29 Aug 2006 17:50:14 -0000	1.233
  +++ TreeCache.java	30 Aug 2006 17:08:19 -0000	1.234
  @@ -94,7 +94,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: TreeCache.java,v 1.233 2006/08/29 17:50:14 msurtani Exp $
  + * @version $Id: TreeCache.java,v 1.234 2006/08/30 17:08:19 msurtani Exp $
    *          <p/>
    * @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
    */
  @@ -680,14 +680,14 @@
                     log.debug("setting cluster properties to default value");
                  }
                  channel = new JChannel(configuration.getClusterConfig());
  -               channel.setOpt(Channel.GET_STATE_EVENTS, Boolean.TRUE);
  +               channel.setOpt(Channel.GET_STATE_EVENTS, true);
                  if (log.isTraceEnabled())
                  {
                     log.trace("cache properties: " + configuration.getClusterConfig());
                  }
               }
  -            channel.setOpt(Channel.AUTO_RECONNECT, Boolean.TRUE);
  -            channel.setOpt(Channel.AUTO_GETSTATE, Boolean.TRUE);
  +            channel.setOpt(Channel.AUTO_RECONNECT, true);
  +            channel.setOpt(Channel.AUTO_GETSTATE, true);
   
   /* Used for JMX jconsole for JDK5.0
               ArrayList servers=MBeanServerFactory.findMBeanServer(null);
  @@ -1883,7 +1883,7 @@
       */
      public NodeImpl get(Fqn fqn) throws CacheException
      {
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal, new Object[]{fqn});
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal, fqn);
         return (NodeImpl) invokeMethod(m);
      }
   
  @@ -1928,7 +1928,7 @@
       */
      public Set getKeys(Fqn fqn) throws CacheException
      {
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.getKeysMethodLocal, new Object[]{fqn});
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.getKeysMethodLocal, fqn);
         return (Set) invokeMethod(m);
      }
   
  @@ -1991,7 +1991,7 @@
   
      protected Object get(Fqn fqn, Object key, boolean sendNodeEvent) throws CacheException
      {
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, new Object[]{fqn, key, Boolean.valueOf(sendNodeEvent)});
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, Boolean.valueOf(sendNodeEvent));
         return invokeMethod(m);
      }
   
  @@ -2130,7 +2130,7 @@
      public void put(Fqn fqn, Map data) throws CacheException
      {
         GlobalTransaction tx = getCurrentTransaction();
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, new Object[]{tx, fqn, data, Boolean.TRUE});
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, tx, fqn, data, true);
         invokeMethod(m);
      }
   
  @@ -2162,7 +2162,7 @@
      public Object put(Fqn fqn, Object key, Object value) throws CacheException
      {
         GlobalTransaction tx = getCurrentTransaction();
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, new Object[]{tx, fqn, key, value, Boolean.TRUE});
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, tx, fqn, key, value, true);
         return invokeMethod(m);
      }
   
  @@ -2184,7 +2184,7 @@
      public void remove(Fqn fqn) throws CacheException
      {
         GlobalTransaction tx = getCurrentTransaction();
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, new Object[]{tx, fqn, Boolean.TRUE});
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, tx, fqn, true);
         invokeMethod(m);
      }
   
  @@ -2200,7 +2200,7 @@
       */
      public void evict(Fqn fqn) throws CacheException
      {
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, new Object[]{fqn});
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, fqn);
         invokeMethod(m);
      }
   
  @@ -2226,7 +2226,7 @@
      public Object remove(Fqn fqn, Object key) throws CacheException
      {
         GlobalTransaction tx = getCurrentTransaction();
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal, new Object[]{tx, fqn, key, Boolean.TRUE});
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal, tx, fqn, key, true);
         return invokeMethod(m);
      }
   
  @@ -2244,7 +2244,7 @@
      public void removeData(Fqn fqn) throws CacheException
      {
         GlobalTransaction tx = getCurrentTransaction();
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal, new Object[]{tx, fqn, Boolean.TRUE});
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal, tx, fqn, true);
         invokeMethod(m);
      }
   
  @@ -2287,7 +2287,7 @@
       */
      public void releaseAllLocks(Fqn fqn)
      {
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.releaseAllLocksMethodLocal, new Object[]{fqn});
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.releaseAllLocksMethodLocal, fqn);
         try
         {
            invokeMethod(m);
  @@ -2313,7 +2313,7 @@
       */
      public String print(Fqn fqn)
      {
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.printMethodLocal, new Object[]{fqn});
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.printMethodLocal, fqn);
         Object retval = null;
         try
         {
  @@ -2360,7 +2360,7 @@
       */
      public Set getChildrenNames(Fqn fqn) throws CacheException
      {
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.getChildrenNamesMethodLocal, new Object[]{fqn});
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.getChildrenNamesMethodLocal, fqn);
         return (Set) invokeMethod(m);
      }
   
  @@ -2863,16 +2863,15 @@
            // TODO even if n is brand new, getData can have empty value instead. Need to fix.
            if ((old_data = n.getData()) == null)
            {
  -            undo_op = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal,
  -                    new Object[]{tx, fqn, Boolean.FALSE});
  +            undo_op = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal, tx, fqn, false);
            }
            else
            {
               undo_op = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal,
  -                    new Object[]{tx, fqn,
  +                    tx, fqn,
                               new HashMap(old_data),
  -                            Boolean.FALSE,
  -                            Boolean.TRUE}); // erase previous hashmap contents
  +                    false,
  +                    true); // erase previous hashmap contents
            }
         }
   
  @@ -2937,14 +2936,11 @@
         {
            if (old_value == null)
            {
  -            undo_op = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
  -                    new Object[]{tx, fqn, key, Boolean.FALSE});
  +            undo_op = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal, tx, fqn, key, false);
            }
            else
            {
  -            undo_op = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
  -                    new Object[]{tx, fqn, key, old_value,
  -                            Boolean.FALSE});
  +            undo_op = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, tx, fqn, key, old_value, false);
            }
            // 1. put undo-op in TX' undo-operations list (needed to rollback TX)
            tx_table.addUndoOperation(tx, undo_op);
  @@ -3076,7 +3072,7 @@
         // this modification) and put it into the TX's undo list.
         if (tx != null && create_undo_ops && !eviction)
         {
  -         undo_op = MethodCallFactory.create(MethodDeclarations.addChildMethodLocal, new Object[]{tx, parent_node.getFqn(), n.getName(), n});
  +         undo_op = MethodCallFactory.create(MethodDeclarations.addChildMethodLocal, tx, parent_node.getFqn(), n.getName(), n, false);
   
            // 1. put undo-op in TX' undo-operations list (needed to rollback TX)
            tx_table.addUndoOperation(tx, undo_op);
  @@ -3141,9 +3137,7 @@
         // this modification) and put it into the TX's undo list.
         if (tx != null && create_undo_ops && old_value != null)
         {
  -         undo_op = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
  -                 new Object[]{tx, fqn, key, old_value,
  -                         Boolean.FALSE});
  +         undo_op = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, tx, fqn, key, old_value, false);
            // 1. put undo-op in TX' undo-operations list (needed to rollback TX)
            tx_table.addUndoOperation(tx, undo_op);
         }
  @@ -3216,7 +3210,7 @@
         // this modification) and put it into the TX's undo list.
         if (tx != null && create_undo_ops && (old_data = n.getData()) != null && !eviction)
         {
  -         undo_op = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, new Object[]{tx, fqn, new HashMap(old_data), Boolean.FALSE});
  +         undo_op = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, tx, fqn, new HashMap(old_data), false);
         }
   
         if (eviction)
  @@ -3331,7 +3325,7 @@
      /**
       * Compensating method to {@link #_remove(GlobalTransaction,Fqn,boolean)}.
       */
  -   public void _addChild(GlobalTransaction gtx, Fqn parent_fqn, Object child_name, DataNode childNode)
  +   public void _addChild(GlobalTransaction gtx, Fqn parent_fqn, Object child_name, DataNode childNode, boolean undoOps)
              throws CacheException
      {
         if (log.isTraceEnabled())
  @@ -3355,6 +3349,13 @@
         Fqn fqn = new Fqn(parent_fqn, child_name);
         notifier.notifyNodeCreated(fqn, true);
         tmp.addChild(child_name, childNode);
  +
  +      if (gtx != null && undoOps)
  +      {
  +         // 1. put undo-op in TX' undo-operations list (needed to rollback TX)
  +         tx_table.addUndoOperation(gtx, MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, gtx, fqn, false));
  +      }
  +
         notifier.notifyNodeCreated(fqn, false);
      }
   
  @@ -3399,7 +3400,7 @@
      /**
       * A 'clustered get' call, called from a remote ClusteredCacheLoader.
       *
  -    * @return a List containing 2 elements: (Boolean.TRUE or Boolean.FALSE) and a value (Object).  If buddy replication
  +    * @return a List containing 2 elements: (true or false) and a value (Object).  If buddy replication
       *         is used one further element is added - an Fqn of the backup subtree in which this node may be found.
       */
      public List _clusteredGet(MethodCall methodCall, Boolean searchBackupSubtrees)
  @@ -3429,12 +3430,12 @@
         List results = new ArrayList(2);
         if (callResults != null)
         {
  -         results.add(Boolean.TRUE);
  +         results.add(true);
            results.add(callResults);
         }
         else
         {
  -         results.add(Boolean.FALSE);
  +         results.add(false);
            results.add(null);
         }
         return results;
  @@ -3449,7 +3450,7 @@
       *                       a byte[] or returned as a List
       * @return <code>List</code> with 1 or 3 elements. First element is a
       *         <code>Boolean</code> indicating whether data was found.  If
  -    *         <code>Boolean.FALSE</code>, the list will only have one element.
  +    *         <code>false</code>, the list will only have one element.
       *         Otherwise, second element is the data itself, structured as
       *         a <code>List</code> of <code>NodeData</code> objects, each of
       *         which represents one <code>Node</code> in the subtree rooted
  @@ -3492,12 +3493,12 @@
         {
            // not found anything.
            retval = new ArrayList(1);
  -         retval.add(Boolean.FALSE);
  +         retval.add(false);
         }
         else
         {
            retval = new ArrayList(3);
  -         retval.add(Boolean.TRUE);
  +         retval.add(true);
   
            List list = getNodeData(new LinkedList(), actualNode);
            if (marshal)
  @@ -3569,13 +3570,13 @@
         MethodCall primaryDataCleanup, backupDataCleanup;
         if (buddyManager.isDataGravitationRemoveOnFind())
         {
  -         primaryDataCleanup = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, new Object[]{null, primary, Boolean.FALSE});
  -         backupDataCleanup = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, new Object[]{null, backup, Boolean.FALSE});
  +         primaryDataCleanup = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, primary, false);
  +         backupDataCleanup = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, backup, false);
         }
         else
         {
  -         primaryDataCleanup = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, new Object[]{primary});
  -         backupDataCleanup = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, new Object[]{backup});
  +         primaryDataCleanup = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, primary);
  +         backupDataCleanup = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, backup);
         }
   
         invokeMethod(primaryDataCleanup);
  @@ -3596,7 +3597,7 @@
            case MethodDeclarations.getChildrenNamesMethodLocal_id:
               return callResults != null || exists(fqn);
            case MethodDeclarations.existsMethod_id:
  -            return ((Boolean) callResults).booleanValue();
  +            return (Boolean) callResults;
            default :
               return false;
         }
  
  
  
  1.20      +2 -2      JBossCache/src/org/jboss/cache/TreeCacheProxyImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCacheProxyImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeCacheProxyImpl.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -b -r1.19 -r1.20
  --- TreeCacheProxyImpl.java	29 Aug 2006 16:35:52 -0000	1.19
  +++ TreeCacheProxyImpl.java	30 Aug 2006 17:08:19 -0000	1.20
  @@ -316,7 +316,7 @@
            if (f.size() == 1)
            {
               newNode = (NodeImpl) NodeFactory.getInstance().createNode(f.getLast(), currentNode, Collections.EMPTY_MAP, treeCache);
  -            treeCache._addChild(gtx, currentNode.getFqn(), f.getLast(), newNode);
  +            treeCache._addChild(gtx, currentNode.getFqn(), f.getLast(), newNode, true);
               retval = new TreeCacheProxyImpl(treeCache, newNode);
            }
            else
  @@ -327,7 +327,7 @@
               {
                  newNode = (NodeImpl) NodeFactory.getInstance().createNode(o, currentParent, Collections.EMPTY_MAP, treeCache);
                  //currentParent.addChild(o, newNode);
  -               treeCache._addChild(gtx, currentParent.getFqn(), o, newNode);
  +               treeCache._addChild(gtx, currentParent.getFqn(), o, newNode, true);
                  currentParent = newNode;
               }
               retval = new TreeCacheProxyImpl(treeCache, currentParent);
  
  
  



More information about the jboss-cvs-commits mailing list