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

Manik Surtani manik at jboss.org
Wed May 23 06:28:55 EDT 2007


  User: msurtani
  Date: 07/05/23 06:28:55

  Modified:    src/org/jboss/cache/pojo/interceptors/dynamic      
                        CachedMapInterceptor.java
                        ReentrancyStopperInterceptor.java
                        CachedListInterceptor.java
                        CachedSetInterceptor.java
                        CacheFieldInterceptor.java BaseInterceptor.java
  Log:
  Initiated a bunch of performance fixes, including replacing CopyOnWriteArraySets with org.jboss.cache.util.concurrent.ConcurrentHashSet.
  Also ran an imports optimiser on the code base - there were a lot of unused imports floating about.
  
  Revision  Changes    Path
  1.2       +17 -14    JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/CachedMapInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedMapInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/CachedMapInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- CachedMapInterceptor.java	13 Jan 2007 15:55:05 -0000	1.1
  +++ CachedMapInterceptor.java	23 May 2007 10:28:55 -0000	1.2
  @@ -6,11 +6,11 @@
    */
   package org.jboss.cache.pojo.interceptors.dynamic;
   
  +import org.jboss.aop.advice.Interceptor;
   import org.jboss.cache.Fqn;
  -import org.jboss.cache.pojo.impl.PojoCacheImpl;
  -import org.jboss.cache.pojo.collection.CollectionInterceptorUtil;
   import org.jboss.cache.pojo.collection.CachedMapImpl;
  -import org.jboss.aop.advice.Interceptor;
  +import org.jboss.cache.pojo.collection.CollectionInterceptorUtil;
  +import org.jboss.cache.pojo.impl.PojoCacheImpl;
   
   import java.util.HashMap;
   import java.util.Iterator;
  @@ -25,7 +25,7 @@
   public class CachedMapInterceptor extends AbstractCollectionInterceptor
   {
   
  -//   protected static final Log log_ = LogFactory.getLog(CachedMapInterceptor.class);
  +   //   protected static final Log log_ = LogFactory.getLog(CachedMapInterceptor.class);
      private static final Map managedMethods_ =
              CollectionInterceptorUtil.getManagedMethods(Map.class);
      private Map methodMap_;
  @@ -42,7 +42,9 @@
         current_ = cacheImpl_;
      }
   
  -   CachedMapInterceptor() {}
  +   CachedMapInterceptor()
  +   {
  +   }
   
      public Object clone()
      {
  @@ -57,7 +59,7 @@
   
      public void setInterceptor(Interceptor intcptr)
      {
  -      CachedMapInterceptor interceptor = (CachedMapInterceptor)intcptr;
  +      CachedMapInterceptor interceptor = (CachedMapInterceptor) intcptr;
         setFqn(interceptor.getFqn());
         setAopInstance(interceptor.getAopInstance());
         setCurrentCopy(interceptor.getCurrentCopy());
  @@ -72,7 +74,7 @@
   
      void setInMemoryCopy(Object obj)
      {
  -      inMemImpl_ = (Map)obj;
  +      inMemImpl_ = (Map) obj;
      }
   
      Object getInMemoryCopy()
  @@ -82,7 +84,7 @@
   
      void setCacheCopy(Object obj)
      {
  -      cacheImpl_ = (Map)obj;
  +      cacheImpl_ = (Map) obj;
      }
   
      Object getCacheCopy()
  @@ -92,7 +94,7 @@
   
      void setCurrentCopy(Object obj)
      {
  -      current_ = (Map)obj;
  +      current_ = (Map) obj;
      }
   
      /**
  @@ -153,7 +155,8 @@
            if (removeFromCache)
            {
               val = cacheImpl_.remove(key);
  -         } else
  +         }
  +         else
            {
               val = cacheImpl_.get(key);
            }
  
  
  
  1.2       +7 -6      JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/ReentrancyStopperInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReentrancyStopperInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/ReentrancyStopperInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- ReentrancyStopperInterceptor.java	13 Jan 2007 15:55:05 -0000	1.1
  +++ ReentrancyStopperInterceptor.java	23 May 2007 10:28:55 -0000	1.2
  @@ -9,9 +9,9 @@
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.jboss.aop.joinpoint.Invocation;
  -import org.jboss.aop.joinpoint.FieldInvocation;
   import org.jboss.aop.advice.Interceptor;
  +import org.jboss.aop.joinpoint.FieldInvocation;
  +import org.jboss.aop.joinpoint.Invocation;
   
   import java.lang.reflect.Field;
   
  @@ -47,13 +47,14 @@
            {
               done.set(true);
               return invocation.invokeNext();
  -         } else
  +         }
  +         else
            {
               //Needs adding, and will invoke target joinpoint skipping the rest of the chain
  -            if(log_.isDebugEnabled())
  +            if (log_.isDebugEnabled())
               {
  -               Field field = ((FieldInvocation)invocation).getField();
  -               log_.debug("Detect recursive interception. Will call the target directly: " +field.getName());
  +               Field field = ((FieldInvocation) invocation).getField();
  +               log_.debug("Detect recursive interception. Will call the target directly: " + field.getName());
               }
               return invocation.invokeTarget();
            }
  
  
  
  1.2       +17 -14    JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/CachedListInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedListInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/CachedListInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- CachedListInterceptor.java	13 Jan 2007 15:55:05 -0000	1.1
  +++ CachedListInterceptor.java	23 May 2007 10:28:55 -0000	1.2
  @@ -6,11 +6,11 @@
    */
   package org.jboss.cache.pojo.interceptors.dynamic;
   
  +import org.jboss.aop.advice.Interceptor;
   import org.jboss.cache.Fqn;
  -import org.jboss.cache.pojo.impl.PojoCacheImpl;
  -import org.jboss.cache.pojo.collection.CollectionInterceptorUtil;
   import org.jboss.cache.pojo.collection.CachedListImpl;
  -import org.jboss.aop.advice.Interceptor;
  +import org.jboss.cache.pojo.collection.CollectionInterceptorUtil;
  +import org.jboss.cache.pojo.impl.PojoCacheImpl;
   
   import java.util.ArrayList;
   import java.util.List;
  @@ -26,7 +26,7 @@
   public class CachedListInterceptor extends AbstractCollectionInterceptor
   {
   
  -//   protected static final Log log_ = LogFactory.getLog(CachedListInterceptor.class);
  +   //   protected static final Log log_ = LogFactory.getLog(CachedListInterceptor.class);
      private static final Map managedMethods_ =
              CollectionInterceptorUtil.getManagedMethods(List.class);
   
  @@ -47,7 +47,9 @@
         current_ = cacheImpl_;
      }
   
  -   public CachedListInterceptor() {}
  +   public CachedListInterceptor()
  +   {
  +   }
   
      public Object clone()
      {
  @@ -62,7 +64,7 @@
   
      public void setInterceptor(Interceptor intcptr)
      {
  -      CachedListInterceptor interceptor = (CachedListInterceptor)intcptr;
  +      CachedListInterceptor interceptor = (CachedListInterceptor) intcptr;
         setFqn(interceptor.getFqn());
         setAopInstance(interceptor.getAopInstance());
         setCurrentCopy(interceptor.getCurrentCopy());
  @@ -123,7 +125,7 @@
   
      void setInMemoryCopy(Object obj)
      {
  -      inMemImpl_ = (List)obj;
  +      inMemImpl_ = (List) obj;
      }
   
      Object getInMemoryCopy()
  @@ -138,12 +140,12 @@
   
      void setCacheCopy(Object obj)
      {
  -      cacheImpl_ = (List)obj;
  +      cacheImpl_ = (List) obj;
      }
   
      void setCurrentCopy(Object obj)
      {
  -      current_ = (List)obj;
  +      current_ = (List) obj;
      }
   
      private void toMemory(boolean removeFromCache)
  @@ -162,7 +164,8 @@
            if (removeFromCache)
            {
               obj = cacheImpl_.remove(j);
  -         } else
  +         }
  +         else
            {
               obj = cacheImpl_.get(j);
            }
  
  
  
  1.2       +14 -12    JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/CachedSetInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedSetInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/CachedSetInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- CachedSetInterceptor.java	13 Jan 2007 15:55:05 -0000	1.1
  +++ CachedSetInterceptor.java	23 May 2007 10:28:55 -0000	1.2
  @@ -6,11 +6,11 @@
    */
   package org.jboss.cache.pojo.interceptors.dynamic;
   
  +import org.jboss.aop.advice.Interceptor;
   import org.jboss.cache.Fqn;
  -import org.jboss.cache.pojo.impl.PojoCacheImpl;
  -import org.jboss.cache.pojo.collection.CollectionInterceptorUtil;
   import org.jboss.cache.pojo.collection.CachedSetImpl;
  -import org.jboss.aop.advice.Interceptor;
  +import org.jboss.cache.pojo.collection.CollectionInterceptorUtil;
  +import org.jboss.cache.pojo.impl.PojoCacheImpl;
   
   import java.util.HashSet;
   import java.util.Iterator;
  @@ -43,7 +43,9 @@
         current_ = cacheImpl_;
      }
   
  -   public CachedSetInterceptor() {}
  +   public CachedSetInterceptor()
  +   {
  +   }
   
      public Object clone()
      {
  @@ -58,7 +60,7 @@
   
      public void setInterceptor(Interceptor intcptr)
      {
  -      CachedSetInterceptor interceptor = (CachedSetInterceptor)intcptr;
  +      CachedSetInterceptor interceptor = (CachedSetInterceptor) intcptr;
         setFqn(interceptor.getFqn());
         setAopInstance(interceptor.getAopInstance());
         setCurrentCopy(interceptor.getCurrentCopy());
  @@ -73,7 +75,7 @@
   
      void setInMemoryCopy(Object obj)
      {
  -      inMemImpl_ = (Set)obj;
  +      inMemImpl_ = (Set) obj;
      }
   
      Object getInMemoryCopy()
  @@ -83,7 +85,7 @@
   
      void setCacheCopy(Object obj)
      {
  -      cacheImpl_ = (Set)obj;
  +      cacheImpl_ = (Set) obj;
      }
   
      Object getCacheCopy()
  @@ -93,7 +95,7 @@
   
      void setCurrentCopy(Object obj)
      {
  -      current_ = (Set)obj;
  +      current_ = (Set) obj;
      }
   
      /**
  
  
  
  1.3       +4 -5      JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/CacheFieldInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheFieldInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/CacheFieldInterceptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- CacheFieldInterceptor.java	16 May 2007 18:29:18 -0000	1.2
  +++ CacheFieldInterceptor.java	23 May 2007 10:28:55 -0000	1.3
  @@ -21,10 +21,9 @@
   import org.jboss.cache.Fqn;
   import org.jboss.cache.pojo.CachedType;
   import org.jboss.cache.pojo.PojoCacheAlreadyDetachedException;
  +import org.jboss.cache.pojo.PojoCacheException;
   import org.jboss.cache.pojo.PojoInstance;
  -import org.jboss.cache.pojo.PojoReference;
   import org.jboss.cache.pojo.PojoUtil;
  -import org.jboss.cache.pojo.PojoCacheException;
   import org.jboss.cache.pojo.impl.PojoCacheImpl;
   import org.jboss.cache.pojo.memory.FieldPersistentReference;
   import org.jboss.cache.pojo.util.AopUtil;
  
  
  
  1.2       +2 -2      JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/BaseInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BaseInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/BaseInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- BaseInterceptor.java	13 Jan 2007 15:55:05 -0000	1.1
  +++ BaseInterceptor.java	23 May 2007 10:28:55 -0000	1.2
  @@ -6,9 +6,9 @@
    */
   package org.jboss.cache.pojo.interceptors.dynamic;
   
  +import org.jboss.aop.advice.Interceptor;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.pojo.PojoInstance;
  -import org.jboss.aop.advice.Interceptor;
   
   
   /**
  
  
  



More information about the jboss-cvs-commits mailing list