From: aclement Date: Sat, 27 Sep 2008 17:26:37 +0000 (+0000) Subject: 248814: perclassloaderdumpdir X-Git-Tag: V1_6_2~23 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ecca4f0d36d30abd26390042da8c5c98895b95ec;p=aspectj.git 248814: perclassloaderdumpdir --- diff --git a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index 95016f655..10eaefbab 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -62,6 +62,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { private List m_dumpTypePattern = new ArrayList(); private boolean m_dumpBefore = false; + private boolean dumpDirPerClassloader = false; private List m_includeTypePattern = new ArrayList(); private List m_excludeTypePattern = new ArrayList(); private List m_includeStartsWith = new ArrayList(); @@ -593,6 +594,9 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { if (definition.shouldDumpBefore()) { m_dumpBefore = true; } + if (definition.createDumpDirPerClassloader()) { + dumpDirPerClassloader = true; + } } } @@ -728,10 +732,21 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { return false; } + protected String getDumpDir() { + if (dumpDirPerClassloader) { + StringBuffer dir = new StringBuffer(); + dir.append("_ajdump").append(File.separator).append(weavingContext.getClassLoaderName()); + return dir.toString(); + } else { + return super.getDumpDir(); + } + } + /* * shared classes methods */ + /** * @return Returns the key. */ diff --git a/loadtime/src/org/aspectj/weaver/loadtime/definition/Definition.java b/loadtime/src/org/aspectj/weaver/loadtime/definition/Definition.java index 3b6e06a1d..73801b930 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/definition/Definition.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/definition/Definition.java @@ -26,6 +26,8 @@ public class Definition { private final List m_dumpPatterns; private boolean m_dumpBefore; + + private boolean perClassloaderDumpDir; private final List m_includePatterns; @@ -42,6 +44,7 @@ public class Definition { public Definition() { m_weaverOptions = new StringBuffer(); m_dumpBefore = false; + perClassloaderDumpDir = false; m_dumpPatterns = new ArrayList(0); m_includePatterns = new ArrayList(0); m_excludePatterns = new ArrayList(0); @@ -67,6 +70,14 @@ public class Definition { return m_dumpBefore; } + public void setCreateDumpDirPerClassloader(boolean b) { + perClassloaderDumpDir = b; + } + + public boolean createDumpDirPerClassloader() { + return perClassloaderDumpDir; + } + public List getIncludePatterns() { return m_includePatterns; } diff --git a/loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java b/loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java index f620e78d9..101fcbaa7 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java @@ -52,6 +52,7 @@ public class DocumentParser extends DefaultHandler { private final static String WEAVER_ELEMENT = "weaver"; private final static String DUMP_ELEMENT = "dump"; private final static String DUMP_BEFOREANDAFTER_ATTRIBUTE = "beforeandafter"; + private final static String DUMP_PERCLASSLOADERDIR_ATTRIBUTE = "perclassloaderdumpdir"; private final static String INCLUDE_ELEMENT = "include"; private final static String EXCLUDE_ELEMENT = "exclude"; private final static String OPTIONS_ATTRIBUTE = "options"; @@ -205,6 +206,10 @@ public class DocumentParser extends DefaultHandler { if (isTrue(beforeAndAfter)) { m_definition.setDumpBefore(true); } + String perWeaverDumpDir = attributes.getValue(DUMP_PERCLASSLOADERDIR_ATTRIBUTE); + if (isTrue(perWeaverDumpDir)) { + m_definition.setCreateDumpDirPerClassloader(true); + } } else if (EXCLUDE_ELEMENT.equals(qName) && m_inAspects) { String typePattern = getWithinAttribute(attributes); if (!isNull(typePattern)) {