[jboss-cvs] JBossAS SVN: r79003 - projects/aop/trunk/aop/src/main/org/jboss/aop/advice.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 1 16:27:20 EDT 2008


Author: flavia.rainone at jboss.com
Date: 2008-10-01 16:27:20 -0400 (Wed, 01 Oct 2008)
New Revision: 79003

Modified:
   projects/aop/trunk/aop/src/main/org/jboss/aop/advice/ClassifiedBindingAndPointcutCollection.java
Log:
[JBAOP-657] Now, the pointcut lists get updated when a binding is removed from
ClassifiedBindingAndPointcutCollection class.

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/advice/ClassifiedBindingAndPointcutCollection.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/advice/ClassifiedBindingAndPointcutCollection.java	2008-10-01 20:19:39 UTC (rev 79002)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/advice/ClassifiedBindingAndPointcutCollection.java	2008-10-01 20:27:20 UTC (rev 79003)
@@ -489,6 +489,11 @@
       // of pointcut infos
       PointcutInfo pointcutInfo = new PointcutInfo(binding.getPointcut(), binding,
             AspectManager.hasTransformationStarted());
+      if (pointcutInfos == UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP)
+      {
+         pointcutInfos = new LinkedHashMap<String, PointcutInfo>();
+      }
+      pointcutInfos.put(pointcutInfo.getPointcut().getName(), pointcutInfo);
       addGet(binding, pointcutInfo);
       addSet(binding, pointcutInfo);
       addConstruction(binding, pointcutInfo);
@@ -522,6 +527,7 @@
       AdviceBinding binding = bindings.remove(name);
       if (binding != null)
       {
+         this.removePointcut(binding.getPointcut());
          this.fieldReadBindings.remove(binding);
          this.fieldWriteBindings.remove(binding);
          this.constructionBindings.remove(binding);
@@ -539,29 +545,11 @@
     */
    public void removePointcut(String name)
    {
-      Pointcut pc = pointcuts.remove(name);
+      Pointcut pc = pointcuts.get(name);
       if (pc != null)
       {
-         this.fieldReadPointcuts.remove(pc);
-         this.fieldWritePointcuts.remove(pc);
-         this.constructionPointcuts.remove(pc);
-         this.constructorExecutionPointcuts.remove(pc);
-         this.methodExecutionPointcuts.remove(pc);
-         this.constructorCallPointcuts.remove(pc);
-         this.methodCallPointcuts.remove(pc);
+         this.removePointcut(pc);
       }
-      
-      PointcutInfo info = pointcutInfos.remove(name);
-      if (info != null)
-      {
-         this.fieldReadPointcutInfos.remove(info);
-         this.fieldWritePointcutInfos.remove(info);
-         this.constructionPointcutInfos.remove(info);
-         this.constructorExecutionPointcutInfos.remove(info);
-         this.methodExecutionPointcutInfos.remove(info);
-         this.constructorCallPointcutInfos.remove(info);
-         this.methodCallPointcutInfos.remove(info);
-      }
    }
    
    /**
@@ -871,6 +859,31 @@
          methodCallPointcutInfos.add(info);
       }
    }
+   
+   /**
+    * Removes the pointcut and the equivalent pointcutInfo.
+    * @param pc the pointcut to be removed
+    */
+   public void removePointcut(Pointcut pc)
+   {
+      this.pointcuts.remove(pc.getName());
+      this.fieldReadPointcuts.remove(pc);
+      this.fieldWritePointcuts.remove(pc);
+      this.constructionPointcuts.remove(pc);
+      this.constructorExecutionPointcuts.remove(pc);
+      this.methodExecutionPointcuts.remove(pc);
+      this.constructorCallPointcuts.remove(pc);
+      this.methodCallPointcuts.remove(pc);
+      
+      PointcutInfo info = pointcutInfos.remove(pc.getName());
+      this.fieldReadPointcutInfos.remove(info);
+      this.fieldWritePointcutInfos.remove(info);
+      this.constructionPointcutInfos.remove(info);
+      this.constructorExecutionPointcutInfos.remove(info);
+      this.methodExecutionPointcutInfos.remove(info);
+      this.constructorCallPointcutInfos.remove(info);
+      this.methodCallPointcutInfos.remove(info);
+   }
 
    private void updatePointcutStats(Pointcut pointcut, AspectManager manager)
    {




More information about the jboss-cvs-commits mailing list