[jboss-cvs] JBossAS SVN: r102781 - in projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop: instrument and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 23 09:07:25 EDT 2010


Author: flavia.rainone at jboss.com
Date: 2010-03-23 09:07:24 -0400 (Tue, 23 Mar 2010)
New Revision: 102781

Added:
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/WeavingRegistry.java
Modified:
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/SuperClassesFirstWeavingStrategy.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java
Log:
[JBAOP-771] Porting to Branch 2_2.

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/SuperClassesFirstWeavingStrategy.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/SuperClassesFirstWeavingStrategy.java	2010-03-23 13:00:06 UTC (rev 102780)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/SuperClassesFirstWeavingStrategy.java	2010-03-23 13:07:24 UTC (rev 102781)
@@ -29,6 +29,7 @@
 
 import org.jboss.aop.instrument.Instrumentor;
 import org.jboss.aop.instrument.InstrumentorFactory;
+import org.jboss.aop.instrument.WeavingRegistry;
 import org.jboss.classpool.scoped.ScopedClassPool;
 import org.jboss.classpool.spi.AbstractClassPool;
 import org.jboss.classpool.spi.ClassPoolRepository;
@@ -125,7 +126,7 @@
 
    private CtClass instrumentClass(AspectManager manager, ScopedClassPool pool, CtClass clazz, boolean isLoadedClass) throws NotFoundException, Exception
    {
-      if (pool.isClassLoadedButNotWoven(clazz.getName()))
+      if (WeavingRegistry.isClassLoadedButNotWoven(pool, clazz.getName()))
       {
          return null;
       }
@@ -210,7 +211,7 @@
          
          if (isLoadedClass)
          {
-            pool.setClassLoadedButNotWoven(clazz.getName());
+            WeavingRegistry.setClassLoadedButNotWoven(pool, clazz.getName());
          }
          
          return null;

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java	2010-03-23 13:00:06 UTC (rev 102780)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java	2010-03-23 13:07:24 UTC (rev 102781)
@@ -716,7 +716,7 @@
       // 3) a new child class is loaded and since the SuperClassesWeavingStrategy will attempt to 
       // weave not modified superclasses, the CtClass will contain the right baseclass stuff, although
       // the already loaded class does not.
-      if (classPool.isClassLoadedButNotWoven(supa.getName()))
+      if (WeavingRegistry.isClassLoadedButNotWoven(classPool, supa.getName()))
       {
          return true;
       }

Added: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/WeavingRegistry.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/WeavingRegistry.java	                        (rev 0)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/WeavingRegistry.java	2010-03-23 13:07:24 UTC (rev 102781)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.instrument;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javassist.ClassPool;
+
+/**
+ * Registers what has been loaded already but is not woven.
+ * 
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+public class WeavingRegistry
+{
+   private static final Map<ClassPool, Collection<String>> loadedButNotWovenClasses = new ConcurrentHashMap<ClassPool, Collection<String>>();
+   
+   public static void setClassLoadedButNotWoven(ClassPool classPool, String classname)
+   {
+      Collection<String> notWovenClasses = loadedButNotWovenClasses.get(classPool);
+      if (notWovenClasses == null)
+      {
+         notWovenClasses = new HashSet<String>();
+         loadedButNotWovenClasses.put(classPool, notWovenClasses);
+      }
+      notWovenClasses.add(classname);
+   }
+
+   public static boolean isClassLoadedButNotWoven(ClassPool classPool, String classname)
+   {
+      return loadedButNotWovenClasses.containsKey(classPool) &&
+         loadedButNotWovenClasses.get(classPool).contains(classname);
+   }
+}
\ No newline at end of file


Property changes on: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/WeavingRegistry.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list