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

Manik Surtani msurtani at jboss.com
Tue Jan 2 12:15:29 EST 2007


  User: msurtani
  Date: 07/01/02 12:15:29

  Modified:    src/org/jboss/cache              AbstractCacheListener.java
                        ConsoleListener.java NodeSPI.java
                        TreeCacheView.java CacheImpl.java
                        CacheListener.java UnversionedNode.java
                        RPCManager.java ReplicationQueue.java CacheSPI.java
                        Cache.java TreeCacheView2.java RegionManager.java
  Log:
  some api changes
  
  Revision  Changes    Path
  1.3       +2 -2      JBossCache/src/org/jboss/cache/AbstractCacheListener.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AbstractCacheListener.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/AbstractCacheListener.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- AbstractCacheListener.java	18 Oct 2006 11:07:54 -0000	1.2
  +++ AbstractCacheListener.java	2 Jan 2007 17:15:29 -0000	1.3
  @@ -43,7 +43,7 @@
      {
      }
   
  -   public void nodeMoved(Fqn from, Fqn to, boolean pre)
  +   public void nodeMoved(Fqn from, Fqn to, boolean pre, boolean isLocal)
      {
      }
   
  @@ -63,7 +63,7 @@
      {
      }
   
  -   public void viewChange(View new_view)  // might be MergeView after merging
  +   public void viewChange(View new_view)
      {
      }
   }
  
  
  
  1.12      +1 -1      JBossCache/src/org/jboss/cache/ConsoleListener.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConsoleListener.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/ConsoleListener.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- ConsoleListener.java	30 Dec 2006 17:49:54 -0000	1.11
  +++ ConsoleListener.java	2 Jan 2007 17:15:29 -0000	1.12
  @@ -147,7 +147,7 @@
   
      }
   
  -   public void nodeMoved(Fqn from, Fqn to, boolean pre)
  +   public void nodeMoved(Fqn from, Fqn to, boolean pre, boolean isLocal)
      {
         if (pre)
         {
  
  
  
  1.7       +31 -20    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.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- NodeSPI.java	30 Dec 2006 17:49:54 -0000	1.6
  +++ NodeSPI.java	2 Jan 2007 17:15:29 -0000	1.7
  @@ -21,28 +21,27 @@
    */
   public interface NodeSPI extends Node
   {
  -   // TODO:
  -   // everything that is not already represented by Node
  -   // that is used by either an interceptor, or eviction policy
  -   // should be added to this interface, provided they are public.
  -
      /**
  -    * Returns true if the children of this node were loaded from a cache loader.
  +    * @return true if the children of this node were loaded from a cache loader.
       */
      boolean getChildrenLoaded();
   
      /**
       * Sets if the children of this node were loaded from a cache loader.
  +    *
  +    * @param loaded true if loaded, false otherwise
       */
      void setChildrenLoaded(boolean loaded);
   
      /**
  -    * Returns true if the data was loaded from the cache loader.
  +    * @return true if the data was loaded from the cache loader.
       */
      public boolean getDataLoaded();
   
      /**
       * Sets if the data was loaded from the cache loader.
  +    *
  +    * @param dataLoaded true if loaded, false otherwise
       */
      public void setDataLoaded(boolean dataLoaded);
   
  @@ -50,6 +49,8 @@
       * Returns a map to access the raw children.
       * The data should only be modified by the cache itself.
       * This method should never return null.
  +    *
  +    * @return Map, keyed by child name, values Nodes.
       */
      Map<Object, Node> getChildrenMap();
   
  @@ -65,20 +66,12 @@
       * 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();
   
      /**
  -    * Initializes the cache for this node and all children as well.
  -    */
  -   void setCache(CacheSPI cache);
  -
  -   /**
  -    * Returns the cache for this node.
  -    */
  -   CacheSPI getCache();
  -
  -   /**
       * Returns an existing child or creates a new one using a global transaction.
       *
       * @return newly created node
  @@ -87,6 +80,8 @@
   
      /**
       * Returns a lock for this node.
  +    *
  +    * @return node lock
       */
      NodeLock getLock();
   
  @@ -95,10 +90,24 @@
       */
      void setFqn(Fqn f);
   
  +   /**
  +    * @return true if the instance has been deleted in the current transaction.
  +    */
      boolean isDeleted();
   
  +   /**
  +    * Marks the node as being deleted (or not) in the current transaction.  This is not recursive, child nodes are not affected.
  +    *
  +    * @param marker true if the node has been deleted, false if not.
  +    */
      void markAsDeleted(boolean marker);
   
  +   /**
  +    * Same as {@link #markAsDeleted(boolean)} except that the option to recurse into children is provided.
  +    *
  +    * @param marker    true if the node has been deleted, false if not.
  +    * @param recursive if true, child nodes (and their children) are marked as well.
  +    */
      void markAsDeleted(boolean marker, boolean recursive);
   
      void addChild(Object nodeName, Node nodeToAdd);
  @@ -113,14 +122,16 @@
   
      // versioning
      /**
  -    * May throw UnsupportedOperationException if versioning is not used.
  +    * May throw UnsupportedOperationException if versioning is not used.  Otherwise, sets the data version of this node.
       *
  -    * @param version
  +    * @param version a {@link org.jboss.cache.optimistic.DataVersion} implementation.
       */
      void setVersion(DataVersion version);
   
      /**
  -    * May throw UnsupportedOperationException if versioning is not used.
  +    * May throw UnsupportedOperationException if versioning is not used.  Otherwise, retrieves the data version of the node.
  +    *
  +    * @return A data version
       */
      DataVersion getVersion();
   }
  
  
  
  1.20      +2 -2      JBossCache/src/org/jboss/cache/TreeCacheView.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCacheView.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeCacheView.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -b -r1.19 -r1.20
  --- TreeCacheView.java	31 Dec 2006 02:08:40 -0000	1.19
  +++ TreeCacheView.java	2 Jan 2007 17:15:29 -0000	1.20
  @@ -53,7 +53,7 @@
    * The view itself caches only the nodes, but doesn't cache any of the data (HashMap) associated with it. When
    * data needs to be displayed, the underlying cache will be accessed directly.
    *
  - * @version $Revision: 1.19 $
  + * @version $Revision: 1.20 $
    * @author<a href="mailto:bela at jboss.org">Bela Ban</a> March 27 2003
    */
   public class TreeCacheView implements TreeCacheViewMBean
  @@ -578,7 +578,7 @@
         nodeCreated(fqn, pre, false);
      }
   
  -   public void nodeMoved(Fqn from, Fqn to, boolean pre)
  +   public void nodeMoved(Fqn from, Fqn to, boolean pre, boolean isLocal)
      {
      }
   
  
  
  
  1.8       +4 -4      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.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- CacheImpl.java	2 Jan 2007 13:30:29 -0000	1.7
  +++ CacheImpl.java	2 Jan 2007 17:15:29 -0000	1.8
  @@ -98,7 +98,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.7 2007/01/02 13:30:29 msurtani Exp $
  + * @version $Id: CacheImpl.java,v 1.8 2007/01/02 17:15:29 msurtani Exp $
    *          <p/>
    * @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
    */
  @@ -159,7 +159,7 @@
      /**
       * HashMap<Thread, List<Lock>, maintains locks acquired by threads (used when no TXs are used)
       */
  -   private final Map lock_table = new ConcurrentHashMap();
  +   private final Map<Thread, List<NodeLock>> lock_table = new ConcurrentHashMap<Thread, List<NodeLock>>();
   
      /**
       * Set<Fqn> of Fqns of the topmost node of internal regions that should
  @@ -314,7 +314,7 @@
      /**
       * Returns the local channel address.
       */
  -   public Object getLocalAddress()
  +   public Address getLocalAddress()
      {
         return channel != null ? channel.getLocalAddress() : null;
      }
  @@ -346,7 +346,7 @@
      /**
       * Returns the lock table.
       */
  -   public Map getLockTable()
  +   public Map<Thread, List<NodeLock>> getLockTable()
      {
         return lock_table;
      }
  
  
  
  1.5       +37 -31    JBossCache/src/org/jboss/cache/CacheListener.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheListener.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/CacheListener.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- CacheListener.java	30 Dec 2006 19:48:46 -0000	1.4
  +++ CacheListener.java	2 Jan 2007 17:15:29 -0000	1.5
  @@ -11,9 +11,8 @@
   import java.util.Map;
   
   /**
  - * A litener API where listeners can be attached to a running {@link Cache} so users can be notified of {@link Cache} events.
  + * A listener API where listeners can be attached to a running {@link Cache} so users can be notified of {@link Cache} events.
    * <p/>
  - * // TODO: Question:  How should this behave WRT transactions?  Should callbacks occur after a tx commits, or as the invocations are made?
    *
    * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
    * @see Cache
  @@ -24,9 +23,9 @@
      /**
       * Called before and after a {@link Node} is created.
       *
  -    * @param fqn
  -    * @param pre
  -    * @param isLocal
  +    * @param fqn     The affected Fqn
  +    * @param pre     whether this notification event is before (pre=true) or after (pre=true) changes have been made to the cache.
  +    * @param isLocal whether the event originated from a remote cache (isLocal=false) or locally.
       */
      void nodeCreated(Fqn fqn, boolean pre, boolean isLocal);
   
  @@ -38,9 +37,10 @@
       * modification.  When called with pre=false, this is the new state of the
       * {@link Node}.
       *
  -    * @param fqn
  -    * @param pre
  -    * @param isLocal
  +    * @param fqn     The affected Fqn
  +    * @param pre     whether this notification event is before (pre=true) or after (pre=true) changes have been made to the cache.
  +    * @param isLocal whether the event originated from a remote cache (isLocal=false) or locally.
  +    * @param data    an unmodifiable {@link Map} of data.  May be empty, will never be null.
       */
      void nodeModified(Fqn fqn, boolean pre, boolean isLocal, Map<Object, Object> data);
   
  @@ -51,16 +51,18 @@
       * When called with pre=true, this is the initial state of the {@link Node} before
       * removal.  When called with pre=false, this is null.
       *
  -    * @param fqn
  -    * @param pre
  -    * @param isLocal
  +    * @param fqn     The affected Fqn
  +    * @param pre     whether this notification event is before (pre=true) or after (pre=true) changes have been made to the cache.
  +    * @param isLocal whether the event originated from a remote cache (isLocal=false) or locally.
  +    * @param data    an unmodifiable {@link Map} of data.
       */
      void nodeRemoved(Fqn fqn, boolean pre, boolean isLocal, Map<Object, Object> data);
   
      /**
       * Called when a {@link Node} is visisted, i.e., {@link Node#get(Object)} is called.
       *
  -    * @param fqn
  +    * @param fqn The affected Fqn
  +    * @param pre whether this notification event is before (pre=true) or after (pre=true) changes have been made to the cache.
       */
      void nodeVisited(Fqn fqn, boolean pre);
   
  @@ -68,8 +70,9 @@
       * Called when a {@link Node} is about to be evicted or has been evicted from the
       * in-memory cache.
       *
  -    * @param fqn
  -    * @param pre
  +    * @param fqn     The affected Fqn
  +    * @param pre     whether this notification event is before (pre=true) or after (pre=true) changes have been made to the cache.
  +    * @param isLocal whether the event originated from a remote cache (isLocal=false) or locally.
       */
      void nodeEvicted(Fqn fqn, boolean pre, boolean isLocal);
   
  @@ -79,55 +82,58 @@
       * <p/>
       * The data passed in is an unmodifiable {@link Map}.  If the {@link Node} is loaded but the data isn't
       * (for example when calling {@link Node#getChildren()}) the data map is null.
  +    *
  +    * @param fqn  The affected Fqn
  +    * @param pre  whether this notification event is before (pre=true) or after (pre=true) changes have been made to the cache.
  +    * @param data an unmodifiable {@link Map} of data.
       */
      void nodeLoaded(Fqn fqn, boolean pre, Map<Object, Object> data);
   
      /**
  -    * Called when a {@link Node} is moved using the {@link Node#move(Node)} API.
  +    * Called when a {@link Node} is moved using the {@link org.jboss.cache.Cache#move(Fqn,Fqn)} API.
       *
  -    * @param from
  -    * @param to
  -    * @param pre
  -    * @see org.jboss.cache.Node#move(Node)
  +    * @param from    The Fqn that is moved
  +    * @param to      The new, resultant Fqn
  +    * @param pre     whether this notification event is before (pre=true) or after (pre=true) changes have been made to the cache.
  +    * @param isLocal whether the event originated from a remote cache (isLocal=false) or locally.
  +    * @see Cache#move(Fqn,Fqn)
       */
  -   void nodeMoved(Fqn from, Fqn to, boolean pre);
  +   void nodeMoved(Fqn from, Fqn to, boolean pre, boolean isLocal);
   
      /**
       * Called when a {@link Node} is activated.
       *
  -    * @param fqn
  -    * @param pre
  +    * @param fqn The affected Fqn
  +    * @param pre whether this notification event is before (pre=true) or after (pre=true) changes have been made to the cache.
       */
      void nodeActivated(Fqn fqn, boolean pre);
   
      /**
       * Called when a {@link Node} is passivated.
       *
  -    * @param fqn
  -    * @param pre
  +    * @param fqn The affected Fqn
  +    * @param pre whether this notification event is before (pre=true) or after (pre=true) changes have been made to the cache.
       */
      void nodePassivated(Fqn fqn, boolean pre);
   
      /**
       * Called when the {@link Cache} is started.
       *
  -    * @param cache
  +    * @param cache a reference to the Cache
       */
      void cacheStarted(CacheSPI cache);
   
      /**
       * Called when the {@link Cache} is stopped.
       *
  -    * @param cache
  +    * @param cache a reference to the Cache
       */
      void cacheStopped(CacheSPI cache);
   
      /**
  -    * // TODO: Perhaps move this to a new ClusterListener?
  -    * // TODO: Should we break the JGroups dependency and just pass a List of new members?
  +    * Called whenever the cache is used in a cluster and the cluster topology changes (i.e., a member joins or leaves the cluster)
       *
  -    * @param new_view
  +    * @param new_view the new JGroups {@link org.jgroups.View} that is the result of the cluster topology change event.
       */
  -   void viewChange(View new_view);  // might be MergeView after merging
  -
  +   void viewChange(View new_view);
   }
  
  
  
  1.5       +2 -2      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.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- UnversionedNode.java	1 Jan 2007 22:12:19 -0000	1.4
  +++ UnversionedNode.java	2 Jan 2007 17:15:29 -0000	1.5
  @@ -188,7 +188,7 @@
         {
            for (Node n : children.values())
            {
  -            n.getNodeSPI().setCache(cache);
  +            ((UnversionedNode) n).setCache(cache);
            }
         }
      }
  @@ -360,7 +360,7 @@
                  {
                     MethodCall undo_op = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, gtx,
                             child_fqn, false);
  -                  cache.addUndoOperation(gtx, undo_op);
  +                  ((CacheImpl) 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());
  
  
  
  1.6       +8 -0      JBossCache/src/org/jboss/cache/RPCManager.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RPCManager.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/RPCManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- RPCManager.java	30 Dec 2006 17:49:54 -0000	1.5
  +++ RPCManager.java	2 Jan 2007 17:15:29 -0000	1.6
  @@ -64,4 +64,12 @@
      {
         return c.callRemoteMethods(recipients, method, arguments, synchronous, excludeSelf, timeout);
      }
  +
  +   /**
  +    * @return Returns the replication queue (if one is used), null otherwise.
  +    */
  +   public ReplicationQueue getReplicationQueue()
  +   {
  +      return c.getReplQueue();
  +   }
   }
  
  
  
  1.13      +5 -4      JBossCache/src/org/jboss/cache/ReplicationQueue.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicationQueue.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/ReplicationQueue.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -r1.12 -r1.13
  --- ReplicationQueue.java	30 Dec 2006 17:49:54 -0000	1.12
  +++ ReplicationQueue.java	2 Jan 2007 17:15:29 -0000	1.13
  @@ -13,6 +13,7 @@
   import org.jboss.cache.marshall.MethodDeclarations;
   
   import java.util.ArrayList;
  +import java.util.LinkedList;
   import java.util.List;
   import java.util.Timer;
   import java.util.TimerTask;
  @@ -22,7 +23,7 @@
    * Periodically (or when certain size is exceeded) takes elements and replicates them.
    *
    * @author <a href="mailto:bela at jboss.org">Bela Ban</a> May 24, 2003
  - * @version $Revision: 1.12 $
  + * @version $Revision: 1.13 $
    */
   public class ReplicationQueue
   {
  @@ -44,7 +45,7 @@
      /**
       * Holds the replication jobs: LinkedList<MethodCall>
       */
  -   private List elements = new ArrayList();
  +   private final List<MethodCall> elements = new LinkedList<MethodCall>();
   
      /**
       * For periodical replication
  @@ -162,12 +163,12 @@
       */
      public void flush()
      {
  -      List l;
  +      List<MethodCall> l;
         synchronized (elements)
         {
            if (log.isTraceEnabled())
               log.trace("flush(): flushing repl queue (num elements=" + elements.size() + ")");
  -         l = new ArrayList(elements);
  +         l = new ArrayList<MethodCall>(elements);
            elements.clear();
         }
   
  
  
  
  1.24      +31 -33    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.23
  retrieving revision 1.24
  diff -u -b -r1.23 -r1.24
  --- CacheSPI.java	30 Dec 2006 17:49:54 -0000	1.23
  +++ CacheSPI.java	2 Jan 2007 17:15:29 -0000	1.24
  @@ -11,7 +11,7 @@
   import org.jboss.cache.interceptors.Interceptor;
   import org.jboss.cache.loader.CacheLoader;
   import org.jboss.cache.loader.CacheLoaderManager;
  -import org.jboss.cache.marshall.MethodCall;
  +import org.jboss.cache.lock.NodeLock;
   import org.jboss.cache.marshall.VersionAwareMarshaller;
   import org.jboss.cache.notifications.Notifier;
   import org.jboss.cache.statetransfer.StateTransferManager;
  @@ -50,8 +50,8 @@
       * Adds a custom interceptor to the interceptor chain, at specified position, where the first interceptor in the chain
       * is at position 0 and the last one at getInterceptorChain().size() - 1.
       *
  -    * @param i
  -    * @param position
  +    * @param i        the interceptor to add
  +    * @param position the position to add the interceptor
       */
      void addInterceptor(Interceptor i, int position);
   
  @@ -59,17 +59,14 @@
       * Removes the interceptor at a specified position, where the first interceptor in the chain
       * is at position 0 and the last one at getInterceptorChain().size() - 1.
       *
  -    * @param position
  +    * @param position the position at which to remove an interceptor
       */
      void removeInterceptor(int position);
   
      /**
  -    * Retrieves the configured {@link CacheLoader}.  If more than one {@link CacheLoader} is configured, this method
  -    * returns an instance of {@link org.jboss.cache.loader.ChainingCacheLoader}.
  -    *
  -    * @return null if no {@link CacheLoader} is configured.
  +    * @return Retrieves a reference to the currently configured {@link org.jboss.cache.loader.CacheLoaderManager}.
       */
  -   CacheLoader getCacheLoader();
  +   CacheLoaderManager getCacheLoaderManager();
   
      /**
       * @return an instance of {@link BuddyManager} if buddy replication is enabled, null otherwise.
  @@ -82,7 +79,9 @@
      TransactionTable getTransactionTable();
   
      /**
  -    * Gets a handle of the RPC manager
  +    * Gets a handle of the RPC manager.
  +    *
  +    * @return the {@link org.jboss.cache.RPCManager} configured.
       */
      RPCManager getRPCManager();
   
  @@ -97,44 +96,39 @@
      String getClusterName();
   
      /**
  -    * @return the version string of the cache.
  +    * @return the number of attributes in the cache.
       */
  -   String getVersion();
  -
  -   // - these two should be static methods on the InvocationContext class
  -   //   since the current context lives in thread local.
  -
  -   //    void setInvocationContext(InvocationContext ctx);
  -   //    InvocationContext getInvocationContext();
  -
  -   // everything that is not already represented by Cache
  -   // that is used by either an interceptor, or eviction policy
  -   // should be added to this interface, provided they are public.
  -
  -   ReplicationQueue getReplQueue();
  -
      int getNumberOfAttributes();
   
  +   /**
  +    * @return the number of nodes in the cache.
  +    */
      int getNumberOfNodes();
   
  -   CacheLoaderManager getCacheLoaderManager();
  -
  -   void addUndoOperation(GlobalTransaction tx, MethodCall undoOperation);
  -
  -   Map getLockTable();
  +   /**
  +    * Retrieves the current table of locks.
  +    *
  +    * @return lock table.
  +    */
  +   Map<Thread, List<NodeLock>> getLockTable();
   
  +   /**
  +    * @return the {@link org.jboss.cache.RegionManager}
  +    */
      RegionManager getRegionManager();
   
      /**
       * Returns the global transaction for this local transaction.
       * Optionally creates a new global transaction if it does not exist.
       *
  +    * @param tx                the current transaction
       * @param createIfNotExists if true creates a new transaction if none exists
  +    * @return a GlobalTransaction
       */
      GlobalTransaction getCurrentTransaction(Transaction tx, boolean createIfNotExists);
   
      /**
  -    * Retrieves the notifier attached with this instance of the cache.  See {@link Notifier}, a class
  +    * @return the notifier attached with this instance of the cache.  See {@link Notifier}, a class
       * that is responsible for emitting notifications to registered {@link CacheListener}s.
       */
      Notifier getNotifier();
  @@ -142,6 +136,7 @@
      /**
       * Returns a node without accessing the interceptor chain.
       *
  +    * @param fqn the Fqn to look up.
       * @return a node if one exists or null
       */
      NodeSPI peek(Fqn fqn);
  @@ -149,9 +144,12 @@
      /**
       * Used with buddy replication's data gravitation interceptor
       *
  +    * @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
       */
  -   GravitateResult gravitateData(Fqn fqn, boolean searchSubtrees, boolean marshal);
  +   GravitateResult gravitateData(Fqn fqn, boolean searchBuddyBackupSubtrees, boolean marshal);
   
      /**
       * Retrieves an instance of a {@link VersionAwareMarshaller}, which is capable of
  
  
  
  1.18      +7 -2      JBossCache/src/org/jboss/cache/Cache.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Cache.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/Cache.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -b -r1.17 -r1.18
  --- Cache.java	31 Dec 2006 03:01:20 -0000	1.17
  +++ Cache.java	2 Jan 2007 17:15:29 -0000	1.18
  @@ -133,7 +133,7 @@
      Object remove(Fqn fqn, Object key);
   
      /**
  -    * Removes a node based on the (absolute) Fqn passed in.*
  +    * Removes a node based on the (absolute) Fqn passed in.
       */
      void removeNode(Fqn fqn);
   
  @@ -205,7 +205,7 @@
      /**
       * @return the local address of this cache in a cluster.  Null if running in local mode.
       */
  -   Object getLocalAddress();
  +   Address getLocalAddress();
   
      /**
       * @return a {@link List} of members in the cluster.  Null if running in local mode.
  @@ -259,4 +259,9 @@
       * @throws NodeNotExistsException may throw one of these if the target node does not exist or if a different thread has moved this node elsewhere already.
       */
      void move(Fqn nodeToMove, Fqn newParent) throws NodeNotExistsException;
  +
  +   /**
  +    * @return the version string of the cache.
  +    */
  +   String getVersion();
   }
  
  
  
  1.19      +2 -2      JBossCache/src/org/jboss/cache/TreeCacheView2.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCacheView2.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeCacheView2.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -b -r1.18 -r1.19
  --- TreeCacheView2.java	30 Dec 2006 17:49:54 -0000	1.18
  +++ TreeCacheView2.java	2 Jan 2007 17:15:29 -0000	1.19
  @@ -53,7 +53,7 @@
    * The view itself caches only the nodes, but doesn't cache any of the data (HashMap) associated with it. When
    * data needs to be displayed, the underlying cache will be accessed directly.
    *
  - * @version $Revision: 1.18 $
  + * @version $Revision: 1.19 $
    */
   public class TreeCacheView2
   {
  @@ -513,7 +513,7 @@
         nodeCreated(fqn, pre, true);
      }
   
  -   public void nodeMoved(Fqn from, Fqn to, boolean pre)
  +   public void nodeMoved(Fqn from, Fqn to, boolean pre, boolean isLocal)
      {
      }
   
  
  
  
  1.18      +0 -410    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.17
  retrieving revision 1.18
  diff -u -b -r1.17 -r1.18
  --- RegionManager.java	30 Dec 2006 17:49:54 -0000	1.17
  +++ RegionManager.java	2 Jan 2007 17:15:29 -0000	1.18
  @@ -776,413 +776,3 @@
         return "RegionManager " + dumpRegions();
      }
   }
  -
  -/*
  -
  -FROM THE ERegionManager:
  -*/
  -
  -/**
  - * Factory to create region from configuration, to track region,
  - * and to resolve naming conflict for regions. Note that in addition to
  - * user-specified regions, there is also a global cache <code>_default_</code>
  - * region that covers everything else.
  - *
  - * @author Ben Wang 02-2004
  - * @author Daniel Huang (dhuang at jboss.org)
  - * @author Brian Stansberry
  - * @version $Id: RegionManager.java,v 1.17 2006/12/30 17:49:54 msurtani Exp $
  - */
  -/*public class ERegionManager
  -{
  -
  -   // There is global cache wide default values if no region is found.
  -   final static Fqn DEFAULT_REGION = new Fqn("_default_");
  -   private static final Log log_ = LogFactory.getLog(ERegionManager.class);
  -
  -   private final Map regionMap_ = new ConcurrentReaderHashMap();
  -   private int longestFqn = 0;
  -
  -   private Timer evictionThread_;
  -   private EvictionTimerTask evictionTimerTask_;
  -   private EvictionConfig config_;
  -   private CacheImpl cache_;
  -
  -   *//**
  - * @deprecated This is provided for JBCache 1.2 backwards API compatibility.
  - *//*
  -   private EvictionPolicy policy_;
  -
  -   public ERegionManager()
  -   {
  -      evictionTimerTask_ = new EvictionTimerTask();
  -   }
  -
  -   public int getEvictionThreadWakeupIntervalSeconds()
  -   {
  -      return (config_ == null ? 0 : config_.getWakeupIntervalSeconds());
  -   }
  -
  -   *//**
  - * @deprecated DO NOT USE THIS METHOD. IT IS PROVIDED FOR EJB3 INTEGRATION BACKWARDS COMPATIBILITY
  - *//*
  -   public ERegion createRegion(String fqn, EvictionAlgorithm algorithm) throws RegionNameConflictException
  -   {
  -      return createRegion(Fqn.fromString(fqn), algorithm);
  -   }
  -
  -   *//**
  - * @deprecated DO NOT USE THIS METHOD. IT IS PROVIDED FOR EJB3 INTEGRATION BACKWARDS COMPATIBILITY
  - *//*
  -   public ERegion createRegion(Fqn fqn, EvictionAlgorithm algorithm) throws RegionNameConflictException
  -   {
  -      if (policy_ == null)
  -      {
  -         throw new RuntimeException("Deprecated API not properly setup for use. The MarshRegionManager must be constructed with a single Policy");
  -      }
  -
  -      EvictionPolicyConfig epc = null;
  -      try
  -      {
  -         epc = (EvictionPolicyConfig) policy_.getEvictionConfigurationClass().newInstance();
  -      }
  -      catch (Exception e)
  -      {
  -         throw new RuntimeException("Could not instantiate EvictionPolicyConfig class", e);
  -      }
  -
  -      return createRegion(fqn, policy_, epc);
  -   }
  -
  -   private void addRegion(ERegion region) throws RegionNameConflictException
  -   {
  -      // Even with ConcurrentReaderHashMap we want to synchronize
  -      // so the following is atomic
  -      synchronized (regionMap_)
  -      {
  -         Fqn fqn = region.getFqnObject();
  -         checkConflict(fqn);
  -         regionMap_.put(fqn, region);
  -         longestFqn = Math.max(longestFqn, fqn.size());
  -      }
  -
  -      // If the region was added programmatically, we need to update
  -      // our config to include it
  -      if (config_ != null)
  -      {
  -         synchronized (config_)
  -         {
  -            List regionConfigs = config_.getEvictionRegionConfigs();
  -            if (regionConfigs == null)
  -               regionConfigs = new ArrayList();
  -
  -            if (!regionConfigs.contains(region.getEvictionRegionConfig()))
  -            {
  -               regionConfigs.add(region.getEvictionRegionConfig());
  -               config_.setEvictionRegionConfigs(regionConfigs);
  -            }
  -         }
  -      }
  -
  -      evictionTimerTask_.addRegionToProcess(region);
  -   }
  -
  -   public ERegion createRegion(EvictionRegionConfig erc) throws RegionNameConflictException
  -   {
  -      // Ensure we have defaults
  -      erc.setDefaultEventQueueSize(config_ == null ? EvictionConfig.EVENT_QUEUE_SIZE_DEFAULT : config_.getDefaultEventQueueSize());
  -
  -      EvictionPolicy policy = instantiatePolicy(erc.getEvictionPolicyConfig());
  -      policy.configure(cache_);
  -
  -      ERegion region = new ERegion(policy, erc);
  -      addRegion(region);
  -
  -      return region;
  -   }*/
  -
  -/**
  - * Supports programatic instantiation of a region from an Fqn and a policy config.
  - *
  - * @param fqn
  - * @param epc
  - * @return
  - * @throws RegionNameConflictException
  - */
  -/*  public ERegion createRegion(Fqn fqn, EvictionPolicyConfig epc) throws RegionNameConflictException
  -{
  -   EvictionRegionConfig erc = new EvictionRegionConfig();
  -   erc.setRegionFqn(fqn);
  -   erc.setEvictionPolicyConfig(epc);
  -   erc.setDefaultEventQueueSize(config_ == null ? EvictionConfig.EVENT_QUEUE_SIZE_DEFAULT : config_.getDefaultEventQueueSize());
  -
  -   return createRegion(erc);
  -}*/
  -
  -/**
  - * Supports programatic instantiation of a region from an Fqn and a policy config.
  - *
  - * @param fqn
  - * @param epc
  - * @return
  - * @throws RegionNameConflictException
  - */
  -/*  public ERegion createRegion(String fqn, EvictionPolicyConfig epc) throws RegionNameConflictException
  -{
  -   return createRegion(Fqn.fromString(fqn), epc);
  -}*/
  -
  -/**
  - * Supports programatic instantiation of a region from an Fqn, EvictionPolicy
  - * and a policy config.  Should only be used in a case where the caller needs
  - * to manipulate the EvictionPolicy; otherwise use the other overloaded versions
  - * of this method.
  - *
  - * @param fqn
  - * @param epc
  - * @return
  - * @throws RegionNameConflictException
  - */
  -/*   public ERegion createRegion(Fqn fqn, EvictionPolicy policy, EvictionPolicyConfig epc) throws RegionNameConflictException
  -   {
  -      EvictionRegionConfig erc = new EvictionRegionConfig();
  -      erc.setRegionFqn(fqn);
  -      erc.setEvictionPolicyConfig(epc);
  -      erc.setDefaultEventQueueSize(config_ == null ? EvictionConfig.EVENT_QUEUE_SIZE_DEFAULT : config_.getDefaultEventQueueSize());
  -
  -      policy.configure(cache_);
  -
  -      ERegion region = new ERegion(policy, erc);
  -      addRegion(region);
  -      return region;
  -   }*/
  -
  -/**
  - * Supports programatic instantiation of a region from an Fqn, EvictionPolicy
  - * and a policy config.  Should only be used in a case where the caller needs
  - * to manipulate the EvictionPolicy; otherwise use the other overloaded versions
  - * of this method.
  - *
  - * @param fqn
  - * @param policy
  - * @param config
  - * @return
  - * @throws RegionNameConflictException
  - */
  -/*   public ERegion createRegion(String fqn, EvictionPolicy policy, EvictionPolicyConfig config) throws RegionNameConflictException
  -   {
  -      return createRegion(Fqn.fromString(fqn), policy, config);
  -   }
  -
  -   public void configure(CacheImpl cache)
  -   {
  -      if (log_.isTraceEnabled())
  -      {
  -         log_.trace("Configuring the eviction region manager");
  -      }
  -      cache_ = cache;
  -
  -      config_ = cache_.getConfiguration().getEvictionConfig();
  -
  -      // done for API 1.2 backwards compatibility for EJB3 integration.
  -      String evictionClass = config_.getDefaultEvictionPolicyClass();
  -      if (evictionClass != null && evictionClass.length() != 0)
  -      {
  -         try
  -         {
  -            policy_ = (EvictionPolicy) Util.loadClass(evictionClass).newInstance();
  -            policy_.configure(cache_);
  -            //cache_.setEvictionPolicyProvider(policy_);
  -         }
  -         catch (Exception e)
  -         {
  -            log_.warn("Default Policy with class name " + evictionClass + " could not be loaded by the classloader");
  -         }
  -      }
  -
  -      EvictionTreeCacheListener listener = new EvictionTreeCacheListener();
  -      cache_.getNotifier().setEvictionPolicyListener(listener);
  -
  -      List regions = config_.getEvictionRegionConfigs();
  -      if (regions != null)
  -      {
  -         for (Iterator iter = regions.iterator(); iter.hasNext();)
  -         {
  -            EvictionRegionConfig erc = (EvictionRegionConfig) iter.next();
  -            try
  -            {
  -               createRegion(erc);
  -            }
  -            catch (RegionNameConflictException e)
  -            {
  -               throw new RuntimeException(
  -                       "Illegal region name specified for eviction policy " + erc.getRegionName()
  -                               + " exception: " + e);
  -            }
  -         }
  -      }
  -   }
  -
  -   public EvictionConfig getEvictionConfig()
  -   {
  -      return config_;
  -   }*/
  -
  -/**
  - * Removes a region by string.
  - */
  -/*   public void removeRegion(String fqn)
  -   {
  -      removeRegion(Fqn.fromString(fqn));
  -   }*/
  -
  -/**
  - * Removes a region by Fqn, returns true if the region was found.
  - */
  -/*  public boolean removeRegion(Fqn fqn)
  -{
  -   ERegion region = (ERegion) regionMap_.remove(fqn);
  -   evictionTimerTask_.removeRegionToProcess(region);
  -
  -   if (region != null && config_ != null)
  -   {
  -      // Update the config to reflect the region's removal
  -      synchronized (config_)
  -      {
  -         List regionConfigs = config_.getEvictionRegionConfigs();
  -         for (Iterator it = regionConfigs.iterator(); it.hasNext();)
  -         {
  -            EvictionRegionConfig erc = (EvictionRegionConfig) it.next();
  -            if (region.getFqnObject().equals(erc.getRegionFqn()))
  -            {
  -               regionConfigs.remove(erc);
  -               config_.setEvictionRegionConfigs(regionConfigs);
  -               break;
  -            }
  -         }
  -      }
  -   }
  -
  -   return region != null;
  -}*/
  -
  -/**
  - * Returns true if the region exists.
  - */
  -/*  public boolean hasRegion(String myFqn)
  -{
  -   return hasRegion(Fqn.fromString(myFqn));
  -}*/
  -
  -/**
  - * Returns true if the region exists.
  - */
  -/*  public boolean hasRegion(Fqn fqn)
  -{
  -   return regionMap_.containsKey(fqn);
  -}*/
  -
  -/**
  - * Returns the MarshRegion belonging to a String FQN.
  - */
  -/*   public ERegion getRegion(String myFqn)
  -   {
  -      return getRegion(Fqn.fromString(myFqn));
  -   }*/
  -
  -/**
  - * Returns the MarshRegion corresponding to this Fqn.
  - */
  -/* public ERegion getRegion(Fqn fqn)
  -{
  -   // Truncate Fqn as an optimization
  -   if (fqn.size() > longestFqn)
  -      fqn = fqn.getFqnChild(0, longestFqn);
  -
  -   ERegion region;
  -   while (!fqn.isRoot())
  -   {
  -      region = (ERegion) regionMap_.get(fqn);
  -      if (region != null)
  -         return region;
  -      fqn = fqn.getParent();
  -   }
  -
  -   if (log_.isTraceEnabled())
  -   {
  -      log_.trace("getRegion(): user-specified region not found: " + fqn
  -              + " will use the global default region");
  -   }
  -   region = (ERegion) regionMap_.get(DEFAULT_REGION);
  -   if (region == null)
  -   {
  -      throw new RuntimeException(
  -              "MarshRegionManager.getRegion(): Default region (" + DEFAULT_REGION + ") is not configured!" +
  -                      " You will need to define it in your EvictionPolicyConfig.");
  -   }
  -   return region;
  -}*/
  -
  -/**
  - * Returns an ordered list of regions.
  - * Orders (by reverse) Fqn.
  - */
  -/* public ERegion[] getRegions()
  -{
  -   Collection c = regionMap_.values();
  -   ERegion r[] = new ERegion[c.size()];
  -   r = (ERegion[]) regionMap_.values().toArray(r);
  -   Arrays.sort(r, new RegionComparator());
  -   return r;
  -}*/
  -
  -/**
  - * Check for conflict in the current regions. There is a conflict
  - * if fqn is any parent fqn of the current regions.
  - *
  - * @param myFqn Current fqn for potential new region.
  - * @throws RegionNameConflictException to indicate a region name conflict has ocurred.
  - */
  -/* public void checkConflict(String myFqn) throws RegionNameConflictException
  -{
  -   checkConflict(Fqn.fromString(myFqn));
  -}*/
  -
  -/**
  - * Check for conflict in the current regions. There is a conflict
  - * if fqn is any parent fqn of the current regions.
  - */
  -/*  public void checkConflict(Fqn fqn) throws RegionNameConflictException
  -   {
  -      for (int i = 0; i < fqn.size(); i++)
  -      {
  -         Fqn child = fqn.getFqnChild(i);
  -         if (regionMap_.containsKey(child))
  -         {
  -            throw new RegionNameConflictException("MarshRegionManager.checkConflict(): new region fqn "
  -                    + fqn + " is in conflict with existing region fqn " + child);
  -         }
  -      }
  -      // We are clear then.
  -   }
  -   class EvictionTreeCacheListener extends AbstractCacheListener
  -   {
  -      public void cacheStarted(CacheSPI cache)
  -      {
  -         log_.debug("Starting eviction timer");
  -         evictionThread_ = new Timer();
  -         evictionThread_.schedule(evictionTimerTask_, ERegionManager.this.getEvictionThreadWakeupIntervalSeconds() * 1000,
  -                 ERegionManager.this.getEvictionThreadWakeupIntervalSeconds() * 1000);
  -      }
  -
  -      public void cacheStopped(CacheSPI cache)
  -      {
  -         log_.debug("Stopping eviction timer ... ");
  -         if (evictionThread_ != null)
  -            evictionThread_.cancel();
  -         evictionThread_ = null;
  -      }
  -   }
  -
  -
  -}*/
  
  
  



More information about the jboss-cvs-commits mailing list