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

Manik Surtani manik at jboss.org
Thu Apr 26 08:03:07 EDT 2007


  User: msurtani
  Date: 07/04/26 08:03:07

  Modified:    src/org/jboss/cache    Node.java CacheImpl.java
                        UnversionedNode.java
  Log:
  JBCACHE-1037
  
  Revision  Changes    Path
  1.63      +11 -1     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.62
  retrieving revision 1.63
  diff -u -b -r1.62 -r1.63
  --- Node.java	12 Mar 2007 18:13:46 -0000	1.62
  +++ Node.java	26 Apr 2007 12:03:07 -0000	1.63
  @@ -206,7 +206,7 @@
       * <pre>
       * Node node;
       * for (Map.Entry me : map.entrySet())
  -    *   node.putAll(me.getKey(), me.getValue());
  +    *   node.put(me.getKey(), me.getValue());
       * </pre>
       *
       * @param map map to copy from
  @@ -214,6 +214,16 @@
      void putAll(Map<K, V> map);
   
      /**
  +    * Similar to {@link #putAll(java.util.Map)} except that it removes any entries that exists in
  +    * the data map first.  Note that this happens atomically, under a single lock.  This is the analogous
  +    * to doing a {@link #clearData()} followed by a {@link #putAll(java.util.Map)} in the same transaction.
  +    *
  +    * @param map map to copy from
  +    */
  +   void replaceAll(Map<K, V> map);
  +
  +
  +   /**
       * Returns the value to which this node maps the specified key.
       * Returns <code>null</code> if the node contains no mapping for this key.
       *
  
  
  
  1.61      +21 -8     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.60
  retrieving revision 1.61
  diff -u -b -r1.60 -r1.61
  --- CacheImpl.java	24 Apr 2007 15:27:21 -0000	1.60
  +++ CacheImpl.java	26 Apr 2007 12:03:07 -0000	1.61
  @@ -462,13 +462,13 @@
         }
      }
   
  -   void fetchPartialState(List <Address> sources, Fqn sourceTarget, Fqn integrationTarget) throws Exception
  +   void fetchPartialState(List<Address> sources, Fqn sourceTarget, Fqn integrationTarget) throws Exception
      {
         String encodedStateId = sourceTarget + StateTransferManager.PARTIAL_STATE_DELIMITER + integrationTarget;
         fetchPartialState(sources, encodedStateId);
      }
   
  -   void fetchPartialState(List <Address> sources, Fqn subtree) throws Exception
  +   void fetchPartialState(List<Address> sources, Fqn subtree) throws Exception
      {
         if (subtree == null)
         {
  @@ -477,7 +477,7 @@
         fetchPartialState(sources, subtree.toString());
      }
   
  -   private void fetchPartialState(List <Address> sources, String stateId) throws Exception
  +   private void fetchPartialState(List<Address> sources, String stateId) throws Exception
      {
         if (sources == null || sources.isEmpty() || stateId == null)
         {
  @@ -507,7 +507,7 @@
   
         log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from members " + targets);
         boolean successfulTransfer = false;
  -      for (Address target: targets)
  +      for (Address target : targets)
         {         
            log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from member " + target);
            isStateSet = false;
  @@ -524,7 +524,7 @@
               }
            }
            log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from member " + target + (successfulTransfer ? " successful" : " failed"));
  -         if(successfulTransfer)
  +         if (successfulTransfer)
                break;
         }
   
  @@ -1430,8 +1430,21 @@
       */
      public void put(Fqn fqn, Map data) throws CacheException
      {
  +      put(fqn, data, false);
  +   }
  +
  +   public void put(Fqn fqn, Map data, boolean erase) throws CacheException
  +   {
         GlobalTransaction tx = getCurrentTransaction();
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, tx, fqn, data, true);
  +      MethodCall m;
  +      if (erase)
  +      {
  +         m = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, tx, fqn, data, true, true);
  +      }
  +      else
  +      {
  +         m = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, tx, fqn, data, true);
  +      }
         invokeMethod(m);
      }
   
  
  
  
  1.27      +6 -1      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.26
  retrieving revision 1.27
  diff -u -b -r1.26 -r1.27
  --- UnversionedNode.java	12 Mar 2007 18:13:46 -0000	1.26
  +++ UnversionedNode.java	26 Apr 2007 12:03:07 -0000	1.27
  @@ -533,6 +533,11 @@
         cache.put(fqn, data);
      }
   
  +   public void replaceAll(Map data)
  +   {
  +      cache.put(fqn, data, true);
  +   }
  +
      public synchronized void putAllDirect(Map<K, V> data)
      {
         if (data == null) return;
  
  
  



More information about the jboss-cvs-commits mailing list