diff options
author | avasseur <avasseur> | 2005-10-24 09:48:39 +0000 |
---|---|---|
committer | avasseur <avasseur> | 2005-10-24 09:48:39 +0000 |
commit | 70888ddc862b717646b236db2767e11a586b6157 (patch) | |
tree | baadee8b68037e531a03cf2da28dc6315e5ca1c0 /loadtime | |
parent | 822751c24272c84bca7a3121a165de163efd436d (diff) | |
download | aspectj-70888ddc862b717646b236db2767e11a586b6157.tar.gz aspectj-70888ddc862b717646b236db2767e11a586b6157.zip |
perf improvements from Matthew and Ron #113511
Diffstat (limited to 'loadtime')
-rw-r--r-- | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | 10 | ||||
-rw-r--r-- | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | 23 |
2 files changed, 21 insertions, 12 deletions
diff --git a/loadtime/src/org/aspectj/weaver/loadtime/Aj.java b/loadtime/src/org/aspectj/weaver/loadtime/Aj.java index a34fdd2a1..079b5439a 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/Aj.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/Aj.java @@ -85,14 +85,14 @@ public class Aj implements ClassPreProcessor { private static Map weavingAdaptors = new WeakHashMap(); static WeavingAdaptor getWeaver(ClassLoader loader, IWeavingContext weavingContext) { - ExplicitlyInitializedClassLaoderWeavingAdaptor adaptor = null; + ExplicitlyInitializedClassLoaderWeavingAdaptor adaptor = null; synchronized(weavingAdaptors) { - adaptor = (ExplicitlyInitializedClassLaoderWeavingAdaptor) weavingAdaptors.get(loader); + adaptor = (ExplicitlyInitializedClassLoaderWeavingAdaptor) weavingAdaptors.get(loader); if (adaptor == null) { // create it and put it back in the weavingAdaptors map but avoid any kind of instantiation // within the synchronized block ClassLoaderWeavingAdaptor weavingAdaptor = new ClassLoaderWeavingAdaptor(loader, weavingContext); - adaptor = new ExplicitlyInitializedClassLaoderWeavingAdaptor(weavingAdaptor); + adaptor = new ExplicitlyInitializedClassLoaderWeavingAdaptor(weavingAdaptor); weavingAdaptors.put(loader, adaptor); } } @@ -114,11 +114,11 @@ public class Aj implements ClassPreProcessor { } } - static class ExplicitlyInitializedClassLaoderWeavingAdaptor { + static class ExplicitlyInitializedClassLoaderWeavingAdaptor { private final ClassLoaderWeavingAdaptor weavingAdaptor; private boolean isInitialized; - public ExplicitlyInitializedClassLaoderWeavingAdaptor(ClassLoaderWeavingAdaptor weavingAdaptor) { + public ExplicitlyInitializedClassLoaderWeavingAdaptor(ClassLoaderWeavingAdaptor weavingAdaptor) { this.weavingAdaptor = weavingAdaptor; this.isInitialized = false; } diff --git a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index 37014675e..547b14170 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -107,10 +107,13 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { // register the definitions registerDefinitions(weaver, loader); - messageHandler = bcelWorld.getMessageHandler(); - // after adding aspects - weaver.prepareForWeave(); + // AV - see #113511 - not sure it is good to skip message handler + if (enabled) { + messageHandler = bcelWorld.getMessageHandler(); + // after adding aspects + weaver.prepareForWeave(); + } } /** @@ -152,10 +155,16 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { // still go thru if definitions is empty since we will configure // the default message handler in there registerOptions(weaver, loader, definitions); - registerAspectExclude(weaver, loader, definitions); - registerAspects(weaver, loader, definitions); - registerIncludeExclude(weaver, loader, definitions); - registerDump(weaver, loader, definitions); + + // AV - see #113511 + if (!definitions.isEmpty()) { + registerAspectExclude(weaver, loader, definitions); + registerAspects(weaver, loader, definitions); + registerIncludeExclude(weaver, loader, definitions); + registerDump(weaver, loader, definitions); + } else { + enabled = false;// will allow very fast skip in shouldWeave() + } } catch (Exception e) { weaver.getWorld().getMessageHandler().handleMessage( new Message("Register definition failed", IMessage.WARNING, e, null) |