]> source.dussan.org Git - aspectj.git/commitdiff
temporary API extension for allowing more weaver control
authoraclement <aclement>
Thu, 8 Feb 2007 12:36:21 +0000 (12:36 +0000)
committeraclement <aclement>
Thu, 8 Feb 2007 12:36:21 +0000 (12:36 +0000)
loadtime/src/org/aspectj/weaver/loadtime/Aj.java

index 4df029d2fb183a498878428df914381f362419aa..8ae0f57f81ba4e3a6365e09989336ad37ec3fae4 100644 (file)
@@ -12,6 +12,7 @@
 package org.aspectj.weaver.loadtime;
 
 import java.util.Map;
+import java.util.Set;
 import java.util.WeakHashMap;
 
 import org.aspectj.weaver.Dump;
@@ -100,6 +101,22 @@ public class Aj implements ClassPreProcessor {
 
         private static Map weavingAdaptors = new WeakHashMap();
 
+        static boolean discardWeaverFor(ClassLoader loader) {
+               Object weaver = null;
+               synchronized(weavingAdaptors) {
+                       weaver = weavingAdaptors.remove(loader);
+               }
+               return weaver!=null;
+        }
+        
+        static Set getActiveLoaderList() {
+               Set existingLoaders = null;
+               synchronized(weavingAdaptors) {
+                       existingLoaders = weavingAdaptors.keySet();
+               }
+               return existingLoaders;
+        }
+        
         static WeavingAdaptor getWeaver(ClassLoader loader, IWeavingContext weavingContext) {
             ExplicitlyInitializedClassLoaderWeavingAdaptor adaptor = null;
             synchronized(weavingAdaptors) {
@@ -179,5 +196,13 @@ public class Aj implements ClassPreProcessor {
     public void flushGeneratedClasses(ClassLoader loader){
        ((ClassLoaderWeavingAdaptor)WeaverContainer.getWeaver(loader, weavingContext)).flushGeneratedClasses();
     }
+    
+    public static boolean discardWeaverFor(ClassLoader loader) {
+       return WeaverContainer.discardWeaverFor(loader);
+    }
+    
+    public static Set getActiveLoaderList() {
+       return WeaverContainer.getActiveLoaderList();
+    }
 
 }
\ No newline at end of file