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

Elias Ross genman at noderunner.net
Tue Nov 21 03:57:02 EST 2006


  User: genman  
  Date: 06/11/21 03:57:02

  Modified:    src/org/jboss/cache/interceptors  
                        BaseCacheLoaderInterceptor.java
                        CacheLoaderInterceptor.java
  Log:
  source code tidy and taking advatage of JDK1.5
  
  Revision  Changes    Path
  1.7       +5 -11     JBossCache/src/org/jboss/cache/interceptors/BaseCacheLoaderInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BaseCacheLoaderInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/BaseCacheLoaderInterceptor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- BaseCacheLoaderInterceptor.java	19 Jul 2006 21:34:43 -0000	1.6
  +++ BaseCacheLoaderInterceptor.java	21 Nov 2006 08:57:02 -0000	1.7
  @@ -6,7 +6,6 @@
    */
   package org.jboss.cache.interceptors;
   
  -import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
   import org.jboss.cache.CacheSPI;
   import org.jboss.cache.loader.CacheLoader;
   
  @@ -14,6 +13,7 @@
   import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
  +import java.util.concurrent.ConcurrentHashMap;
   
   /**
    * asbtract superclass for cache loader and cache store interceptors.
  @@ -23,7 +23,7 @@
   public class BaseCacheLoaderInterceptor extends Interceptor
   {
       protected CacheLoader loader = null;
  -    private Map lockMap = new ConcurrentReaderHashMap();
  +    private Map lockMap = new ConcurrentHashMap();
   
       public void setCache(CacheSPI cache)
       {
  @@ -36,7 +36,7 @@
        * fqn accessed.  Nothing complex here - no isolation levels or
        * consideration for the operation being performed for now.
        */
  -    protected void obtainLoaderLock(Object lock)
  +    protected void obtainLoaderLock(Object lock) throws InterruptedException
       {
           Thread current = Thread.currentThread();
   
  @@ -45,14 +45,8 @@
               while (lockMap.containsKey(lock) && !lockMap.get(lock).equals(current))
               {
                   // someone else owns the lock.  Wait for it.
  -                try
  -                {
                       this.wait();
                   }
  -                catch (InterruptedException e)
  -                {
  -                }
  -            }
   
               if (lockMap.containsKey(lock) && !lockMap.get(lock).equals(current))
               {
  @@ -84,7 +78,7 @@
           }
       }
   
  -    protected void obtainLoaderLocks(List locks)
  +    protected void obtainLoaderLocks(List locks) throws InterruptedException
       {
           Iterator it = locks.iterator();
           while (it.hasNext())
  
  
  
  1.60      +8 -8      JBossCache/src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheLoaderInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -b -r1.59 -r1.60
  --- CacheLoaderInterceptor.java	20 Nov 2006 03:53:54 -0000	1.59
  +++ CacheLoaderInterceptor.java	21 Nov 2006 08:57:02 -0000	1.60
  @@ -6,6 +6,7 @@
   import org.jboss.cache.GlobalTransaction;
   import org.jboss.cache.InvocationContext;
   import org.jboss.cache.Node;
  +import org.jboss.cache.NodeSPI;
   import org.jboss.cache.TransactionEntry;
   import org.jboss.cache.TransactionTable;
   import org.jboss.cache.TreeCache;
  @@ -32,7 +33,7 @@
    * Loads nodes that don't exist at the time of the call into memory from the CacheLoader
    *
    * @author Bela Ban
  - * @version $Id: CacheLoaderInterceptor.java,v 1.59 2006/11/20 03:53:54 genman Exp $
  + * @version $Id: CacheLoaderInterceptor.java,v 1.60 2006/11/21 08:57:02 genman Exp $
    */
   public class CacheLoaderInterceptor extends BaseCacheLoaderInterceptor implements CacheLoaderInterceptorMBean
   {
  @@ -284,23 +285,22 @@
            node = createNodes(fqn, null); // dont care about local transactions
   
         // Create one DataNode per child, mark as UNINITIALIZED
  -      for (Iterator i = children_names.iterator(); i.hasNext();)
  +      for (Object name : children_names)
         {
  -         String child_name = (String) i.next();
  -         Fqn child_fqn = new Fqn(child_name); // this is a RELATIVE Fqn!!
  +         Fqn child_fqn = new Fqn(name); // this is a RELATIVE Fqn!!
  +         
            // create child if it didn't exist
            cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
            node.addChild(child_fqn);
  -         Node child = findChild(node, child_name);
  -         cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
  +         Node child = node.getNodeSPI().getChildrenMap().get(name);
            if (isActivation && recursive)
            {
               // load data for children as well!
  -            child.put(loader.get(child.getFqn()));
  +            node.getNodeSPI().getRawData().putAll(loader.get(child.getFqn()));
            }
            else
            {
  -            child.put(TreeCache.UNINITIALIZED, null);
  +            node.getNodeSPI().getRawData().put(TreeCache.UNINITIALIZED, null);
            }
            if (recursive)
            {
  
  
  



More information about the jboss-cvs-commits mailing list