From 62674469a5b197c8db0849b3359776d9b5083e2e Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 8 Feb 2007 12:36:21 +0000 Subject: [PATCH] temporary API extension for allowing more weaver control --- .../src/org/aspectj/weaver/loadtime/Aj.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/loadtime/src/org/aspectj/weaver/loadtime/Aj.java b/loadtime/src/org/aspectj/weaver/loadtime/Aj.java index 4df029d2f..8ae0f57f8 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/Aj.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/Aj.java @@ -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 -- 2.39.5