[jboss-cvs] JBossAS SVN: r76039 - projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Jul 20 19:01:46 EDT 2008


Author: flavia.rainone at jboss.com
Date: 2008-07-20 19:01:45 -0400 (Sun, 20 Jul 2008)
New Revision: 76039

Modified:
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/JoinPointInfo.java
Log:
[JBAOP-616] Added mechanism to keep tracking of copies of an info. This is essencial because the only scenario
where an info acquires interceptors without going through an interceptor chain factory is by copying.
Nonetheless, those interceptors must be removed from the copied info when the advice binding that created
them is removed. To allow this, this mechanism has been added.

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/JoinPointInfo.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/JoinPointInfo.java	2008-07-20 22:23:06 UTC (rev 76038)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/JoinPointInfo.java	2008-07-20 23:01:45 UTC (rev 76039)
@@ -24,6 +24,7 @@
 import java.lang.annotation.Annotation;
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.jboss.aop.advice.GeneratedAdvisorInterceptor;
@@ -53,6 +54,9 @@
    
    private String adviceString;
 
+   private Collection<WeakReference<JoinPointInfo>> copies =
+      new ArrayList<WeakReference<JoinPointInfo>>();
+   
    protected JoinPointInfo(Advisor advisor, Class<?> clazz)
    {
       this.clazz = new WeakReference<Class<?>>(clazz); 
@@ -71,8 +75,9 @@
          this.interceptors = new Interceptor[other.interceptors.length];
          System.arraycopy(other.interceptors, 0, this.interceptors, 0, other.interceptors.length);
       }
-      if (other.interceptorChain != null)this.interceptorChain.addAll(interceptorChain);
+      if (other.interceptorChain != null)this.interceptorChain.addAll(other.interceptorChain);
       this.setAdvisor(advisor);
+      other.copies.add(new WeakReference<JoinPointInfo>(this));
    }
 
    @SuppressWarnings("deprecation")
@@ -185,6 +190,16 @@
    protected abstract Joinpoint internalGetJoinpoint();
    public abstract JoinPointInfo copy(Advisor advisor);
    
+   /**
+    * Returns all instances that are a copy of this info.
+    * 
+    * @return all instances that are a copy of this info
+    */
+   public Collection<WeakReference<JoinPointInfo>> getCopies()
+   {
+      return this.copies;
+   }
+   
    public Object resolveClassMetaData(Object key, Object attr)
    {
       return getAdvisor().getClassMetaData().getMetaData(key, attr);




More information about the jboss-cvs-commits mailing list