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

Manik Surtani msurtani at jboss.com
Thu Oct 12 19:03:57 EDT 2006


  User: msurtani
  Date: 06/10/12 19:03:57

  Modified:    src/org/jboss/cache/loader       CacheLoader.java
                        AbstractCacheLoader.java ClusteredCacheLoader.java
                        AsyncCacheLoader.java ChainingCacheLoader.java
                        AbstractDelegatingCacheLoader.java
  Log:
  a LOT of changes around Regions, in an attempt to unify eviction and marshalling regions
  
  Revision  Changes    Path
  1.10      +245 -247  JBossCache/src/org/jboss/cache/loader/CacheLoader.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheLoader.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/CacheLoader.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- CacheLoader.java	12 Sep 2006 20:16:55 -0000	1.9
  +++ CacheLoader.java	12 Oct 2006 23:03:57 -0000	1.10
  @@ -6,17 +6,17 @@
    */
   package org.jboss.cache.loader;
   
  -import org.jboss.cache.marshall.RegionManager;
  -import org.jboss.cache.Fqn;
   import org.jboss.cache.CacheSPI;
  +import org.jboss.cache.Fqn;
   import org.jboss.cache.Modification;
  +import org.jboss.cache.RegionManager;
   
   import java.io.ObjectInputStream;
   import java.io.ObjectOutputStream;
  +import java.util.List;
  +import java.util.Map;
   import java.util.Properties;
   import java.util.Set;
  -import java.util.Map;
  -import java.util.List;
   
   /**
    * A <code>CacheLoader</code> implementation persists and load keys to and from
  @@ -32,15 +32,16 @@
    * called, followed by another {@link #start()}. Finally, when shut down,
    * {@link #destroy()} is called, after which the loader is unusable.
    *
  + * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
    * @see CacheSPI
    * @since 2.0.0
  - * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
    */
   
   public interface CacheLoader
   {
       /**
        * Sets the configuration.  This is called before {@link #create()} and {@link #start()}.
  +    *
        * @param properties a collection of configuration properties
        */
       void setConfig(Properties properties);
  @@ -51,6 +52,7 @@
        * This method allows this CacheLoader to invoke methods on cache,
        * including fetching additional configuration information.  This method is
        * called be called after the CacheLoader instance has been constructed.
  +    *
        * @param c The cache on which this loader works
        */
       void setCache(CacheSPI c);
  @@ -71,7 +73,7 @@
   
       /**
        * Returns all keys and values from the persistent store, given a fully qualified name.
  -     *
  +    * <p/>
        * NOTE that the expected return value of this method has changed from JBossCache 1.2.x
        * and before!  This will affect cache loaders written prior to JBossCache 1.3.0 and such
        * implementations should be checked for compliance with the behaviour expected.
  @@ -86,6 +88,7 @@
   
       /**
        * Returns true if the CacheLoader has a node with a {@link Fqn}.
  +    *
        * @return true if node exists, false otherwise
        */
       boolean exists(Fqn name) throws Exception;
  @@ -104,6 +107,7 @@
        * insertion.
        * This is the same behavior as {@link Map#putAll}.
        * If the node does not exist, all parent nodes from the root down are created automatically
  +    *
        * @param name The fully qualified name of the node
        * @param attributes A Map of attributes. Can be null
        */
  @@ -185,45 +189,42 @@
       * ObjectOutputStream parameter is used for initialization of a new TreeCache instance. 
       * When the state gets transferred to the new cache instance its cacheloader calls
       * {@link #storeEntireState(ObjectInputStream)}
  -    *
  -    * <p>
  +    * <p/>
  +    * <p/>
       * Implementations of this method should not catch any exception or close the 
       * given ObjectOutputStream parameter. In order to ensure cacheloader interoperability 
       * contents of the cache are written to the ObjectOutputStream as a sequence of 
       * NodeData objects.
  -    * 
  -    * <p>
  +    * <p/>
  +    * <p/>
       * Default implementation is provided by {@link AbstractCacheLoader} and ensures cacheloader 
       * interoperability. Implementors are encouraged to consider extending AbstractCacheLoader 
       * prior to implementing completely custom cacheloader.  
       * 
  +    * @param os ObjectOutputStream to write state
       * @see AbstractCacheLoader#loadEntireState(ObjectOutputStream)
       * @see NodeData
  -    *
  -    * @param os ObjectOutputStream to write state
       */
       void loadEntireState(ObjectOutputStream os) throws Exception;
   
       /**
  -    * 
       * Stores the entire state for this cache by reading it from a provided ObjectInputStream. 
       * The state was provided to this cache by calling {@link #loadEntireState(ObjectOutputStream)}} 
       * on some other cache instance. State currently in storage gets overwritten.
  -    * <p>
  +    * <p/>
       * Implementations of this method should not catch any exception or close the 
       * given ObjectInputStream parameter. In order to ensure cacheloader interoperability 
       * contents of the cache are read from the ObjectInputStream as a sequence of 
       * NodeData objects.
  -    * 
  -    * <p>
  +    * <p/>
  +    * <p/>
       * Default implementation is provided by {@link AbstractCacheLoader} and ensures cacheloader 
       * interoperability. Implementors are encouraged to consider extending AbstractCacheLoader 
       * prior to implementing completely custom cacheloader. 
       *  
  +    * @param is ObjectInputStream to read state
       * @see AbstractCacheLoader#storeEntireState(ObjectInputStream)
       * @see NodeData    
  -    * @param is ObjectInputStream to read state 
  -    * 
       */
       void storeEntireState(ObjectInputStream is) throws Exception;
   
  @@ -232,30 +233,27 @@
       * and writes it to a provided ObjectOutputStream. State written to the provided 
       * ObjectOutputStream parameter is used for activation of a portion of a new TreeCache instance. 
       * When the state gets transferred to the new cache instance its cacheloader calls
  -    * {@link #storeState(Fqn, ObjectInputStream)}.
  -    *
  -    * <p>
  +    * {@link #storeState(Fqn,ObjectInputStream)}.
  +    * <p/>
  +    * <p/>
       * Implementations of this method should not catch any exception or close the 
       * given ObjectOutputStream parameter. In order to ensure cacheloader interoperability 
       * contents of the cache are written to the ObjectOutputStream as a sequence of 
       * NodeData objects.
  -    * 
  -    * <p>
  +    * <p/>
  +    * <p/>
       * Default implementation is provided by {@link AbstractCacheLoader} and ensures cacheloader 
       * interoperability. Implementors are encouraged to consider extending AbstractCacheLoader 
       * prior to implementing completely custom cacheloader.     
       * 
  -    *
       * @param subtree Fqn naming the root (i.e. highest level parent) node of
       *                the subtree for which state is requested.
  -    *                
       * @param os ObjectOutputStream to write state               
  -    *
  -    * @see AbstractCacheLoader#loadState(Fqn, ObjectOutputStream)
  +    * @see AbstractCacheLoader#loadState(Fqn,ObjectOutputStream)
       * @see org.jboss.cache.Region#activate() 
       * @see NodeData
       */
  -    void loadState(Fqn subtree,ObjectOutputStream os) throws Exception;
  +   void loadState(Fqn subtree, ObjectOutputStream os) throws Exception;
   
       /**
       * Stores the given portion of the cache tree's state in secondary storage.
  @@ -266,23 +264,23 @@
       * in the latter case <code>subtree</code> would be the Fqn of the buddy
       * backup region for
       * a buddy group; e.g.
  -    * 
  -    * <p>
  +    * <p/>
  +    * <p/>
       * If the the transferred state had Fqns starting with "/a" and
       * <code>subtree</code> was "/_BUDDY_BACKUP_/192.168.1.2:5555" then the
       * state should be stored in the local persistent store under
       * "/_BUDDY_BACKUP_/192.168.1.2:5555/a"
       * </p>
  -    * 
  -    * <p>
  -    * 
  +    * <p/>
  +    * <p/>
  +    * <p/>
       * Implementations of this method should not catch any exception or close the 
       * given ObjectInputStream parameter. In order to ensure cacheloader interoperability 
       * contents of the cache are read from the ObjectInputStream as a sequence of 
       * NodeData objects.
  -    * <p> 
  -    * 
  -    * <p>
  +    * <p/>
  +    * <p/>
  +    * <p/>
       * Default implementation is provided by {@link AbstractCacheLoader} and ensures cacheloader 
       * interoperability. Implementors are encouraged to consider extending AbstractCacheLoader 
       * prior to implementing completely custom cacheloader. 
  @@ -294,18 +292,16 @@
       *                already children of <code>subtree</code>, then their
       *                Fqns should be altered to make them children of
       *                <code>subtree</code> before they are persisted.
  -    *                
  -    * @see AbstractCacheLoader#storeState(Fqn, ObjectInputStream)               
  +    * @see AbstractCacheLoader#storeState(Fqn,ObjectInputStream)
       * @see NodeData
  -    *
       */
  -    void storeState(Fqn subtree,ObjectInputStream is) throws Exception;
  +   void storeState(Fqn subtree, ObjectInputStream is) throws Exception;
   
       /**
  -    * Sets the {@link org.jboss.cache.marshall.RegionManager} this object should use to manage
  +    * Sets the {@link org.jboss.cache.RegionManager} this object should use to manage
       * marshalling/unmarshalling of different regions using different
       * classloaders.
  -    * <p>
  +    * <p/>
       * <strong>NOTE:</strong> This method is only intended to be used
       * by the <code>TreeCache</code> instance this cache loader is
       * associated with.
  @@ -317,12 +313,14 @@
   
       /**
        * Lifecycle method, called when the cache loader is created.
  +    *
        * @throws java.lang.Exception
        */
       void create() throws java.lang.Exception;
   
       /**
        * Lifecycle method, called when the cache loader is started.
  +    *
        * @throws java.lang.Exception
        */
       void start() throws java.lang.Exception;
  
  
  
  1.9       +3 -3      JBossCache/src/org/jboss/cache/loader/AbstractCacheLoader.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AbstractCacheLoader.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/AbstractCacheLoader.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- AbstractCacheLoader.java	22 Sep 2006 18:16:31 -0000	1.8
  +++ AbstractCacheLoader.java	12 Oct 2006 23:03:57 -0000	1.9
  @@ -10,8 +10,8 @@
   import org.jboss.cache.CacheSPI;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.Modification;
  +import org.jboss.cache.RegionManager;
   import org.jboss.cache.buddyreplication.BuddyManager;
  -import org.jboss.cache.marshall.RegionManager;
   
   import java.io.ObjectInputStream;
   import java.io.ObjectOutputStream;
  @@ -141,7 +141,7 @@
      {
         if (regionManager != null)
         {
  -         regionManager.setUnmarshallingClassLoader(subtree);
  +         regionManager.setContextClassLoaderAsCurrent(subtree);
         }
      }
   
  
  
  
  1.14      +1 -1      JBossCache/src/org/jboss/cache/loader/ClusteredCacheLoader.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ClusteredCacheLoader.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/ClusteredCacheLoader.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- ClusteredCacheLoader.java	31 Aug 2006 14:56:45 -0000	1.13
  +++ ClusteredCacheLoader.java	12 Oct 2006 23:03:57 -0000	1.14
  @@ -10,11 +10,11 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.Modification;
  +import org.jboss.cache.RegionManager;
   import org.jboss.cache.TreeCache;
   import org.jboss.cache.marshall.MethodCall;
   import org.jboss.cache.marshall.MethodCallFactory;
   import org.jboss.cache.marshall.MethodDeclarations;
  -import org.jboss.cache.marshall.RegionManager;
   import org.jgroups.Address;
   import org.jgroups.blocks.GroupRequest;
   
  
  
  
  1.20      +10 -15    JBossCache/src/org/jboss/cache/loader/AsyncCacheLoader.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AsyncCacheLoader.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/AsyncCacheLoader.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -b -r1.19 -r1.20
  --- AsyncCacheLoader.java	29 Sep 2006 18:27:21 -0000	1.19
  +++ AsyncCacheLoader.java	12 Oct 2006 23:03:57 -0000	1.20
  @@ -9,21 +9,16 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.CacheException;
  -import org.jboss.cache.CacheSPI;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.Modification;
  -import org.jboss.cache.marshall.RegionManager;
   
   import java.io.IOException;
  -import java.io.ObjectInputStream;
  -import java.io.ObjectOutputStream;
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
   import java.util.Properties;
  -import java.util.Set;
   
   /**
    * The AsyncCacheLoader is a delegating cache loader that extends
  
  
  
  1.11      +2 -2      JBossCache/src/org/jboss/cache/loader/ChainingCacheLoader.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ChainingCacheLoader.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/ChainingCacheLoader.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- ChainingCacheLoader.java	6 Oct 2006 12:26:28 -0000	1.10
  +++ ChainingCacheLoader.java	12 Oct 2006 23:03:57 -0000	1.11
  @@ -8,8 +8,8 @@
   
   import org.jboss.cache.Fqn;
   import org.jboss.cache.Modification;
  +import org.jboss.cache.RegionManager;
   import org.jboss.cache.config.CacheLoaderConfig;
  -import org.jboss.cache.marshall.RegionManager;
   
   import java.io.ObjectInputStream;
   import java.io.ObjectOutputStream;
  @@ -324,7 +324,7 @@
      }
   
      /**
  -    * No-op, as this class doesn't directly use the RegionManager.
  +    * No-op, as this class doesn't directly use the MarshRegionManager.
       */
      public void setRegionManager(RegionManager manager)
      {
  
  
  
  1.2       +8 -8      JBossCache/src/org/jboss/cache/loader/AbstractDelegatingCacheLoader.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AbstractDelegatingCacheLoader.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/AbstractDelegatingCacheLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- AbstractDelegatingCacheLoader.java	29 Sep 2006 18:27:21 -0000	1.1
  +++ AbstractDelegatingCacheLoader.java	12 Oct 2006 23:03:57 -0000	1.2
  @@ -9,20 +9,20 @@
   import org.jboss.cache.CacheSPI;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.Modification;
  -import org.jboss.cache.marshall.RegionManager;
  +import org.jboss.cache.RegionManager;
   
  +import java.io.ObjectInputStream;
  +import java.io.ObjectOutputStream;
  +import java.util.List;
  +import java.util.Map;
   import java.util.Properties;
   import java.util.Set;
  -import java.util.Map;
  -import java.util.List;
  -import java.io.ObjectOutputStream;
  -import java.io.ObjectInputStream;
   
   /**
    * AbstractDelegatingCacheLoader provides standard functionality for a cache loader that simply delegates each
    * operation defined in the cache loader interface to the underlying cache loader, basically acting as a proxy to the
    * real cache loader. 
  - *
  + * <p/>
    * Any cache loader implementation that extends this class would be required to override any of the methods in
    * order to provide a different or added behaviour.
    *
  
  
  



More information about the jboss-cvs-commits mailing list