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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 6 17:51:09 EDT 2008


Author: flavia.rainone at jboss.com
Date: 2008-08-06 17:51:09 -0400 (Wed, 06 Aug 2008)
New Revision: 76731

Modified:
   projects/aop/trunk/aop/src/main/org/jboss/aop/ClassAdvisor.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/HotSwapStrategy.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/InterceptorChainObserver.java
Log:
[JBAOP-617] All tests pass, except for the gc on prepareAll.

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/ClassAdvisor.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/ClassAdvisor.java	2008-08-06 21:46:07 UTC (rev 76730)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/ClassAdvisor.java	2008-08-06 21:51:09 UTC (rev 76731)
@@ -608,8 +608,8 @@
       // Notify observer about this change
       if (this.interceptorChainObserver != null)
       {
-         this.interceptorChainObserver.interceptorChainsUpdated(fieldReadInterceptors, fieldWriteInterceptors,
-               constructorInterceptors, methodInfos);
+         this.interceptorChainObserver.interceptorChainsUpdated(fieldReadInfos,
+               fieldWriteInfos, constructorInfos, methodInfos);
       }
    }
 
@@ -693,8 +693,8 @@
       // Notify observer about this change
       if (this.interceptorChainObserver != null)
       {
-         this.interceptorChainObserver.interceptorChainsUpdated(fieldReadInterceptors, fieldWriteInterceptors,
-               constructorInterceptors, methodInfos);
+         this.interceptorChainObserver.interceptorChainsUpdated(fieldReadInfos,
+               fieldWriteInfos, constructorInfos, methodInfos);
       }
    }
 
@@ -813,8 +813,8 @@
       // Notify observer about this change
       if (this.interceptorChainObserver != null)
       {
-         this.interceptorChainObserver.interceptorChainsUpdated(fieldReadInterceptors, fieldWriteInterceptors,
-               constructorInterceptors, methodInfos);
+         this.interceptorChainObserver.interceptorChainsUpdated(fieldReadInfos,
+               fieldWriteInfos, constructorInfos, methodInfos);
       }
       
       //TODO: optimize this
@@ -1172,9 +1172,8 @@
          rebuildCallerInterceptors();
          if (interceptorChainObserver != null)
          {
-            this.interceptorChainObserver.interceptorChainsUpdated(
-                  fieldReadInterceptors, fieldWriteInterceptors,
-                  constructionInterceptors, methodInfos);
+            this.interceptorChainObserver.interceptorChainsUpdated(fieldReadInfos,
+                  fieldWriteInfos, constructorInfos, methodInfos);
          }
       }
       catch (Exception ex)
@@ -2042,8 +2041,8 @@
    {
       if (observer != null)
       {
-         observer.initialInterceptorChains(this.clazz, fieldReadInterceptors, fieldWriteInterceptors,
-               constructorInterceptors, methodInfos);
+         observer.initialInterceptorChains(this.clazz, fieldReadInfos,
+               fieldWriteInfos, constructorInfos, methodInfos);
       }
       this.interceptorChainObserver = observer;
    }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/HotSwapStrategy.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/HotSwapStrategy.java	2008-08-06 21:46:07 UTC (rev 76730)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/HotSwapStrategy.java	2008-08-06 21:51:09 UTC (rev 76731)
@@ -265,8 +265,8 @@
        * This method must be called before any other notification method is invoked.
        * @see org.jboss.aop.InterceptorChainObserver#initialInterceptorChains(Interceptor[][], Interceptor[][], Interceptor[][], TLongObjectHashMap)
        */
-      public synchronized void initialInterceptorChains(final Class<?> reflectionClass, Interceptor[][] fieldReadInterceptors, Interceptor[][] fieldWriteInterceptors,
-            Interceptor[][] constructorInterceptors, MethodInterceptors methodInterceptors)
+      public synchronized void initialInterceptorChains(final Class<?> reflectionClass, FieldInfo[] fieldReadInfos, FieldInfo[] fieldWriteInfos,
+            ConstructorInfo[] constructorInfos, MethodInterceptors methodInterceptors)
       {
          Constructor<?>[] declaredConstructors = null;
          if (System.getSecurityManager() == null)
@@ -310,9 +310,9 @@
             }
          }
          
-         this.fieldReadInterceptors = copyInterceptorChains(fieldReadInterceptors);
-         this.fieldWriteInterceptors = copyInterceptorChains(fieldWriteInterceptors);
-         this.constructorInterceptors = copyInterceptorChains(constructorInterceptors);
+         this.fieldReadInterceptors = copyInterceptorChains(fieldReadInfos);
+         this.fieldWriteInterceptors = copyInterceptorChains(fieldWriteInfos);
+         this.constructorInterceptors = copyInterceptorChains(constructorInfos);
          this.methodInterceptors = new HashMap<MethodInfo, Interceptor[]>();
          long[] methodKeys = methodInterceptors.keys();
          for (int i = 0; i < methodKeys.length; i++)
@@ -321,8 +321,8 @@
             MethodInfo methodInfo = methodInterceptors.getMethodInfo(key);
             this.methodInterceptors.put(methodInfo, methodInfo.getInterceptors());
          }
-         this.fields = fieldReadInterceptors.length;
-         this.constructors = constructorInterceptors.length;
+         this.fields = fieldReadInfos.length;
+         this.constructors = constructorInfos.length;
          this.methods = methodInterceptors.size();
          this.newlyAdvised = new JoinpointStatusUpdate.ClassJoinpoints(fields, constructors, methods);
          this.newlyUnadvised = new JoinpointStatusUpdate.ClassJoinpoints(fields, constructors, methods);
@@ -332,8 +332,8 @@
        * Notification method.
        * @see InterceptorChainObserver#interceptorChainsUpdated(Interceptor[][], Interceptor[][], Interceptor[][], MethodInterceptors)
        */
-      public synchronized void interceptorChainsUpdated(Interceptor[][] newFieldReadInterceptors, Interceptor[][] newFieldWriteInterceptors,
-            Interceptor[][] newConstructorInterceptors, MethodInterceptors newMethodInterceptors)
+      public synchronized void interceptorChainsUpdated(FieldInfo[] newFieldReadInfos, FieldInfo[] newFieldWriteInfos,
+            ConstructorInfo[] newConstructorInfos, MethodInterceptors newMethodInterceptors)
       {
          if (instanceInterceptors == 0)
          {
@@ -353,14 +353,14 @@
                   newlyUnadvised.methodExecutions.add(newMethodInfo);
                }
             }
-            fillNewStateCollections(fieldReadInterceptors, newFieldReadInterceptors, newlyAdvised.fieldReads, newlyUnadvised.fieldReads, null);
-            fillNewStateCollections(fieldWriteInterceptors, newFieldWriteInterceptors, newlyAdvised.fieldWrites, newlyUnadvised.fieldWrites, null);
-            fillNewStateCollections(constructorInterceptors, newConstructorInterceptors, newlyAdvised.constructorExecutions, newlyUnadvised.constructorExecutions, this.constructorIndexMap);
+            fillNewStateCollections(fieldReadInterceptors, newFieldReadInfos, newlyAdvised.fieldReads, newlyUnadvised.fieldReads, null);
+            fillNewStateCollections(fieldWriteInterceptors, newFieldWriteInfos, newlyAdvised.fieldWrites, newlyUnadvised.fieldWrites, null);
+            fillNewStateCollections(constructorInterceptors, newConstructorInfos, newlyAdvised.constructorExecutions, newlyUnadvised.constructorExecutions, this.constructorIndexMap);
             newJoinpointUpdate(this.getJoinpointStatusUpdate());
          }
-         this.fieldReadInterceptors = copyInterceptorChains(newFieldReadInterceptors);
-         this.fieldWriteInterceptors = copyInterceptorChains(newFieldWriteInterceptors);
-         this.constructorInterceptors = copyInterceptorChains(newConstructorInterceptors);
+         this.fieldReadInterceptors = copyInterceptorChains(newFieldReadInfos);
+         this.fieldWriteInterceptors = copyInterceptorChains(newFieldWriteInfos);
+         this.constructorInterceptors = copyInterceptorChains(newConstructorInfos);
          long[] methodKeys = newMethodInterceptors.keys();
          for (int i = 0; i < methodKeys.length; i++)
          {
@@ -440,12 +440,12 @@
        * 
        * @param chains array of chains to be copied
        */
-      private Interceptor[][] copyInterceptorChains(Interceptor[][] chains)
+      private Interceptor[][] copyInterceptorChains(JoinPointInfo[] updatedInfos)
       {
-         Interceptor[][] copy = new Interceptor[chains.length][];
-         for (int i = 0; i < chains.length; i++)
+         Interceptor[][] copy = new Interceptor[updatedInfos.length][];
+         for (int i = 0; i < updatedInfos.length; i++)
          {
-            copy[i] = chains[i];
+            copy[i] = updatedInfos[i].getInterceptors();
          }
          return copy;
       }
@@ -474,14 +474,14 @@
        * @param newlyAdvised collection to which the newly advised joinpoints will be added.
        * @param newlyAdvised collection to which the newly unadvised joinpoints will be added.
        */
-      private void fillNewStateCollections(Interceptor[][] interceptors, Interceptor[][] newInterceptors,
+      private void fillNewStateCollections(Interceptor[][] interceptors, JoinPointInfo[] updatedInfos,
             Collection<Integer> newlyAdvised, Collection<Integer> newlyUnadvised, int[] indexMap)
       {
          if (instanceInterceptors > 0)
             return;
          for (int i = 0; i < interceptors.length; i++) {
             Interceptor[] oldInterceptorsChain = interceptors[i];
-            Interceptor[] newInterceptorsChain = newInterceptors[i];
+            Interceptor[] newInterceptorsChain = updatedInfos[i].getInterceptors();
             boolean interceptedBefore = oldInterceptorsChain != null && oldInterceptorsChain.length > 0;
             boolean interceptedNow = newInterceptorsChain != null && newInterceptorsChain.length > 0;
             if (!interceptedBefore && interceptedNow)

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/InterceptorChainObserver.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/InterceptorChainObserver.java	2008-08-06 21:46:07 UTC (rev 76730)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/InterceptorChainObserver.java	2008-08-06 21:51:09 UTC (rev 76731)
@@ -21,7 +21,6 @@
   */
 package org.jboss.aop;
 
-import org.jboss.aop.advice.Interceptor;
 
 /**
  * Observes all the interceptor chains related to a class. 
@@ -40,8 +39,8 @@
     * @param methodInterceptors interceptor chains to be applied at methods' executions.
     * @param clazz the reflection class whose joinpoints the interceptor chains will be applied to.
     */
-   public void initialInterceptorChains(Class<?> clazz, Interceptor[][] fieldReadInterceptors, Interceptor[][] fieldWriteInterceptors,
-         Interceptor[][] constructorInterceptors, MethodInterceptors methodInterceptors);
+   public void initialInterceptorChains(Class<?> clazz, FieldInfo[] fieldReadInfos, FieldInfo[] fieldWriteInfos,
+         ConstructorInfo[] constructorInfos, MethodInterceptors methodInterceptors);
 
    /**
     * Notifies the observer that the class interceptor chains were updated.
@@ -50,8 +49,8 @@
     * @param newConstructorInterceptors new interceptor chains to be applied at constructors' executions.
     * @param newMethodInterceptors new interceptor chains to be applied at methods' executions.
     */
-   public void interceptorChainsUpdated(Interceptor[][] newFieldReadInterceptors, Interceptor[][] newFieldWriteInterceptors,
-         Interceptor[][] newConstructorInterceptors, MethodInterceptors newMethodInterceptors);
+   public void interceptorChainsUpdated(FieldInfo[] fieldReadInfos, FieldInfo[] fieldWriteInfos,
+         ConstructorInfo[] constructorInfos, MethodInterceptors methodInterceptors);
    
    /**
     * Notifies that an interceptor was added to an instance of




More information about the jboss-cvs-commits mailing list