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

Manik Surtani msurtani at jboss.com
Mon Jan 15 11:19:09 EST 2007


  User: msurtani
  Date: 07/01/15 11:19:09

  Modified:    src/org/jboss/cache   CacheImpl.java CacheSPI.java
  Log:
  * JBCACHE-752
  * Refactored GravitationResult
  * Updated CacheMarshaller200 to marshall GravitateResults and NodeData
  * Moved NodeData (and related objects) to o.j.c.marshall pkg
  
  Revision  Changes    Path
  1.28      +16 -52    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.27
  retrieving revision 1.28
  diff -u -b -r1.27 -r1.28
  --- CacheImpl.java	15 Jan 2007 11:22:38 -0000	1.27
  +++ CacheImpl.java	15 Jan 2007 16:19:09 -0000	1.28
  @@ -22,7 +22,6 @@
   import org.jboss.cache.jmx.CacheJmxWrapperMBean;
   import org.jboss.cache.loader.CacheLoader;
   import org.jboss.cache.loader.CacheLoaderManager;
  -import org.jboss.cache.loader.NodeData;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.lock.LockStrategyFactory;
   import org.jboss.cache.lock.LockUtil;
  @@ -33,6 +32,7 @@
   import org.jboss.cache.marshall.MethodCall;
   import org.jboss.cache.marshall.MethodCallFactory;
   import org.jboss.cache.marshall.MethodDeclarations;
  +import org.jboss.cache.marshall.NodeData;
   import org.jboss.cache.marshall.RegionNameConflictException;
   import org.jboss.cache.marshall.RegionNotFoundException;
   import org.jboss.cache.marshall.VersionAwareMarshaller;
  @@ -68,8 +68,6 @@
   import javax.transaction.Transaction;
   import javax.transaction.TransactionManager;
   import java.io.ByteArrayInputStream;
  -import java.io.ByteArrayOutputStream;
  -import java.io.IOException;
   import java.io.InputStream;
   import java.io.NotSerializableException;
   import java.io.OutputStream;
  @@ -98,7 +96,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.27 2007/01/15 11:22:38 msurtani Exp $
  + * @version $Id: CacheImpl.java,v 1.28 2007/01/15 16:19:09 msurtani Exp $
    *          <p/>
    * @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
    */
  @@ -690,6 +688,7 @@
               //            disp = new RpcDispatcher(channel, ml, this, this);
   
               disp.setRequestMarshaller(getMarshaller());
  +            disp.setResponseMarshaller(getMarshaller());
   
               setBuddyReplicationConfig(configuration.getBuddyReplicationConfig());
               break;
  @@ -2783,33 +2782,15 @@
      }
   
      /**
  -    * Used with buddy replication's data gravitation interceptor
  +    * Used with buddy replication's data gravitation interceptor.  If marshalling is necessary, ensure that the cache is
  +    * configured to use {@link org.jboss.cache.config.Configuration#useRegionBasedMarshalling} and the {@link org.jboss.cache.Region}
  +    * pertaining to the Fqn passed in is activated, and has an appropriate ClassLoader.
       *
       * @param fqn            the fqn to gravitate
  -    * @param searchSubtrees should _BUDDY_BACKUP_ subtrees be searched
  -    * @param marshal        should the list of NodeData being gravitated be marshalled into
  -    *                       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>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
  -    *         at <code>fqn</code>. If param <code>mnarshal</code> is
  -    *         <code>true</code>, this second element will have been marshalled
  -    *         to a <code>byte[]</code>, otherwise it will be the raw list.
  -    *         The third element represents the Fqn in the _BUDDY_BACKUP_
  -    *         region that needs to be cleaned in order to remove this data
  -    *         once the new owner has acquired it.
  +    * @param searchBuddyBackupSubtrees if true, buddy backup subtrees are searched and if false, they are not.
  +    * @return a GravitateResult which contains the data for the gravitation
       */
  -   public List _gravitateData(Fqn fqn, boolean searchSubtrees, boolean marshal)
  -           throws CacheException
  -   {
  -      GravitateResult result = gravitateData(fqn, searchSubtrees, marshal);
  -      return result.asList();
  -   }
  -
  -   public GravitateResult gravitateData(Fqn fqn, boolean searchSubtrees, boolean marshal)
  +   public GravitateResult gravitateData(Fqn fqn, boolean searchSubtrees)
              throws CacheException
      {
         // we need to get the state for this Fqn and its sub-nodes.
  @@ -2846,30 +2827,13 @@
            backupNodeFqn = BuddyManager.getBackupFqn(BuddyManager.getGroupNameFromAddress(getLocalAddress()), fqn);
         }
   
  -      List list = getNodeData(new LinkedList(), actualNode);
  -      if (marshal)
  -      {
  -         try
  -         {
  -            ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
  -            MarshalledValueOutputStream maos = new MarshalledValueOutputStream(baos);
  -            maos.writeObject(list);
  -            maos.close();
  -            return GravitateResult.marshalledResult(baos.toByteArray(), backupNodeFqn);
  -         }
  -         catch (IOException e)
  -         {
  -            throw new CacheException("Failure marshalling subtree at " + fqn, e);
  -         }
  -      }
  -      else
  -      {
  +      List<NodeData> list = getNodeData(new LinkedList<NodeData>(), actualNode);
  +
            GravitateResult gr = GravitateResult.subtreeResult(list, backupNodeFqn);
            return gr;
         }
  -   }
   
  -   private List getNodeData(List list, NodeSPI node)
  +   private List<NodeData> getNodeData(List<NodeData> list, NodeSPI node)
      {
         NodeData data = new NodeData(BuddyManager.getActualFqn(node.getFqn()), node.getDataDirect());
         list.add(data);
  
  
  
  1.28      +5 -4      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.27
  retrieving revision 1.28
  diff -u -b -r1.27 -r1.28
  --- CacheSPI.java	5 Jan 2007 08:58:37 -0000	1.27
  +++ CacheSPI.java	15 Jan 2007 16:19:09 -0000	1.28
  @@ -152,14 +152,15 @@
      NodeSPI peek(Fqn fqn);
   
      /**
  -    * Used with buddy replication's data gravitation interceptor
  +    * Used with buddy replication's data gravitation interceptor.  If marshalling is necessary, ensure that the cache is
  +    * configured to use {@link org.jboss.cache.config.Configuration#useRegionBasedMarshalling} and the {@link org.jboss.cache.Region}
  +    * pertaining to the Fqn passed in is activated, and has an appropriate ClassLoader.
       *
       * @param fqn                       the fqn to gravitate
       * @param searchBuddyBackupSubtrees if true, buddy backup subtrees are searched and if false, they are not.
  -    * @param marshal                   if true, the data is marshalled using the {@link org.jboss.cache.marshall.VersionAwareMarshaller}
  -    * @return a List which should be a data structure
  +    * @return a GravitateResult which contains the data for the gravitation
       */
  -   GravitateResult gravitateData(Fqn fqn, boolean searchBuddyBackupSubtrees, boolean marshal);
  +   GravitateResult gravitateData(Fqn fqn, boolean searchBuddyBackupSubtrees);
   
      /**
       * Retrieves an instance of a {@link VersionAwareMarshaller}, which is capable of
  
  
  



More information about the jboss-cvs-commits mailing list