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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 4 14:27:17 EDT 2008


Author: flavia.rainone at jboss.com
Date: 2008-08-04 14:27:17 -0400 (Mon, 04 Aug 2008)
New Revision: 76619

Modified:
   projects/aop/trunk/aop/src/main/org/jboss/aop/HotSwapStrategy.java
Log:
[JBAOP-617] Interceptor chains must be copied in HotSwapStrategy.

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-04 18:26:15 UTC (rev 76618)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/HotSwapStrategy.java	2008-08-04 18:27:17 UTC (rev 76619)
@@ -310,9 +310,9 @@
             }
          }
          
-         this.fieldReadInterceptors = fieldReadInterceptors;
-         this.fieldWriteInterceptors = fieldWriteInterceptors;
-         this.constructorInterceptors = constructorInterceptors;
+         this.fieldReadInterceptors = copyInterceptorChains(fieldReadInterceptors);
+         this.fieldWriteInterceptors = copyInterceptorChains(fieldWriteInterceptors);
+         this.constructorInterceptors = copyInterceptorChains(constructorInterceptors);
          this.methodInterceptors = new HashMap<MethodInfo, Interceptor[]>();
          long[] methodKeys = methodInterceptors.keys();
          for (int i = 0; i < methodKeys.length; i++)
@@ -358,9 +358,9 @@
             fillNewStateCollections(constructorInterceptors, newConstructorInterceptors, newlyAdvised.constructorExecutions, newlyUnadvised.constructorExecutions, this.constructorIndexMap);
             newJoinpointUpdate(this.getJoinpointStatusUpdate());
          }
-         this.fieldReadInterceptors = newFieldReadInterceptors;
-         this.fieldWriteInterceptors = newFieldWriteInterceptors;
-         this.constructorInterceptors = newConstructorInterceptors;
+         this.fieldReadInterceptors = copyInterceptorChains(newFieldReadInterceptors);
+         this.fieldWriteInterceptors = copyInterceptorChains(newFieldWriteInterceptors);
+         this.constructorInterceptors = copyInterceptorChains(newConstructorInterceptors);
          long[] methodKeys = newMethodInterceptors.keys();
          for (int i = 0; i < methodKeys.length; i++)
          {
@@ -434,8 +434,23 @@
          updateAdvisenessStatus(this.newlyUnadvised);
          HotSwapStrategy.this.interceptorChainsUpdated();
       }
-
+      
       /**
+       * Creates a copy of {@code chains}.
+       * 
+       * @param chains array of chains to be copied
+       */
+      private Interceptor[][] copyInterceptorChains(Interceptor[][] chains)
+      {
+         Interceptor[][] copy = new Interceptor[chains.length][];
+         for (int i = 0; i < chains.length; i++)
+         {
+            copy[i] = chains[i];
+         }
+         return copy;
+      }
+      
+      /**
        * Gets the joinpoint status update containing all the observed interceptor
        * chain changes information.
        * @return the joinpoint status update.




More information about the jboss-cvs-commits mailing list