[jboss-cvs] JBossAS SVN: r82527 - in projects/aop/trunk: asintegration-mc/src/main/org/jboss/aop/classpool/jbosscl and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 23 09:17:50 EST 2008
Author: kabir.khan at jboss.com
Date: 2008-12-23 09:17:50 -0500 (Tue, 23 Dec 2008)
New Revision: 82527
Added:
projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolDelegatingTestSuite.java
projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolSanityTestSuite.java
Modified:
projects/aop/trunk/asintegration-core/src/main/org/jboss/aop/classpool/AbstractClassPoolDomain.java
projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/classpool/jbosscl/JBossClClassPoolFactory.java
projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/classpool/jbosscl/JBossClDelegatingClassPool.java
projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/ClassPoolWithRepositoryTestCase.java
projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTestSuite.java
Log:
[JBAOP-666] Switch to use JBossClClassPoolDomain
Modified: projects/aop/trunk/asintegration-core/src/main/org/jboss/aop/classpool/AbstractClassPoolDomain.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/org/jboss/aop/classpool/AbstractClassPoolDomain.java 2008-12-23 14:01:55 UTC (rev 82526)
+++ projects/aop/trunk/asintegration-core/src/main/org/jboss/aop/classpool/AbstractClassPoolDomain.java 2008-12-23 14:17:50 UTC (rev 82527)
@@ -55,33 +55,6 @@
return getCachedOrCreate(parentPool, classname, create);
}
}
-
- protected CtClass getCachedOrCreate(BaseClassPool parentPool, String classname, boolean create)
- {
- if (parentPool == null)
- {
- return null;
- }
-
- CtClass clazz = null;
- if (!parentPool.childFirstLookup)
- {
- clazz = getCachedOrCreateFromPoolParent(parentPool, classname, create);
- }
-
- //We can use the exposed methods directly to avoid the overhead of NotFoundException
- clazz = parentPool.getCached(classname);
- if (clazz == null && create)
- {
- clazz = parentPool.createCtClass(classname, true);
- }
-
- if (clazz == null && !parentPool.childFirstLookup)
- {
- clazz = getCachedOrCreateFromPoolParent(parentPool, classname, create);
- }
- return clazz;
- }
protected CtClass getCachedOrCreate(ClassPool parentPool, String classname, boolean create)
{
@@ -95,5 +68,4 @@
return null;
}
}
-
}
Modified: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/classpool/jbosscl/JBossClClassPoolFactory.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/classpool/jbosscl/JBossClClassPoolFactory.java 2008-12-23 14:01:55 UTC (rev 82526)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/classpool/jbosscl/JBossClClassPoolFactory.java 2008-12-23 14:17:50 UTC (rev 82527)
@@ -30,7 +30,6 @@
import org.jboss.aop.asintegration.jboss5.DomainRegistry;
import org.jboss.aop.classpool.AbstractJBossClassPoolFactory;
-import org.jboss.aop.classpool.BasicClassPoolDomain;
import org.jboss.aop.classpool.ClassPoolDomain;
import org.jboss.aop.classpool.ClassPoolDomainRegistry;
import org.jboss.aop.classpool.NonDelegatingClassPool;
@@ -62,7 +61,7 @@
{
Module module = registry.getModule(cl);
ClassPoolDomain domain = getDomain(module, cl);
- return new JBossClDelegatingClassPool(domain, cl, parent, repository, getTempURL(module));
+ return new JBossClDelegatingClassPool(domain, cl, parent, repository, module);
}
return new NonDelegatingClassPool(cl, parent, repository, true);
@@ -97,7 +96,7 @@
}
parentPoolDomain = ClassPoolDomainRegistry.getInstance().getDomain(parentDomain);
}
- poolDomain = new BasicClassPoolDomain(domain.getName(), parentPoolDomain);
+ poolDomain = new JBossClClassPoolDomain(domain.getName(), parentPoolDomain);
//The determination of parentFirst/-Last might need revisiting
poolDomain.setParentFirst(domain.getParentPolicy() == ParentPolicy.BEFORE);
Modified: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/classpool/jbosscl/JBossClDelegatingClassPool.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/classpool/jbosscl/JBossClDelegatingClassPool.java 2008-12-23 14:01:55 UTC (rev 82526)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/classpool/jbosscl/JBossClDelegatingClassPool.java 2008-12-23 14:17:50 UTC (rev 82527)
@@ -34,6 +34,7 @@
import org.jboss.aop.classpool.ClassPoolDomain;
import org.jboss.aop.classpool.DelegatingClassPool;
import org.jboss.classloader.spi.base.BaseClassLoader;
+import org.jboss.classloading.spi.dependency.Module;
import org.jboss.virtual.plugins.context.memory.MemoryContextFactory;
/**
@@ -43,15 +44,19 @@
*/
public class JBossClDelegatingClassPool extends DelegatingClassPool
{
- URL tempURL;
+ Module module;
// For loadClass tmpdir creation for UCL
protected final Object tmplock = new Object();
protected JBossClDelegatingClassPool(ClassPoolDomain domain, ClassLoader cl, ClassPool parent,
- ScopedClassPoolRepository repository, URL tmpURL)
+ ScopedClassPoolRepository repository, Module module)
{
super(domain, cl, parent, repository);
- this.tempURL = tmpURL;
+ if (module == null)
+ {
+ throw new IllegalStateException("Null Module");
+ }
+ this.module = module;
}
//Copied from JBoss5ClassPool
@@ -59,7 +64,7 @@
{
lockInCache(cc);
final ClassLoader myloader = getClassLoader();
- if (myloader == null || tempURL == null)
+ if (myloader == null || module.getDynamicClassRoot() == null)
{
return super.toClass(cc, loader, domain);
}
@@ -67,7 +72,7 @@
try
{
String classFileName = getResourceName(cc.getName());
- URL outputURL = new URL(tempURL.toString() + "/" + classFileName);
+ URL outputURL = new URL(module.getDynamicClassRoot().toString() + "/" + classFileName);
//Write the classfile to the temporary url
synchronized (tmplock)
{
Modified: projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/ClassPoolWithRepositoryTestCase.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/ClassPoolWithRepositoryTestCase.java 2008-12-23 14:01:55 UTC (rev 82526)
+++ projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/ClassPoolWithRepositoryTestCase.java 2008-12-23 14:17:50 UTC (rev 82527)
@@ -731,6 +731,10 @@
CtClass strA = poolA.getCtClass(STRING);
CtClass strB = poolB.getCtClass(STRING);
assertSame(strA, strB);
- assertSame(ClassPool.getDefault(), strA.getClassPool());
+ assertSame(strB.getClassPool(), strA.getClassPool());
+ assertNotSame(poolA, strA.getClassPool());
+ assertNotSame(poolB, strB.getClassPool());
+ ClassPool def = ClassPool.getDefault();
+ int i = 4;
}
}
Added: projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolDelegatingTestSuite.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolDelegatingTestSuite.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolDelegatingTestSuite.java 2008-12-23 14:17:50 UTC (rev 82527)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.test.aop.classpool.jbosscl.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class JBossClClassPoolDelegatingTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("UclClassPool All Tests");
+
+ suite.addTest(ClassPoolWithRepositoryTestCase.suite());
+ suite.addTest(ClassPoolWithModuleDependencyTestCase.suite());
+ suite.addTest(ClassPoolWithPackageDependencyTestCase.suite());
+ suite.addTest(ClassPoolWithReExportModuleTestCase.suite());
+ suite.addTest(ClassPoolWithReExportPackageTestCase.suite());
+ suite.addTest(ClassPoolWithUsesPackageTestCase.suite());
+
+ return suite;
+ }
+
+}
Added: projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolSanityTestSuite.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolSanityTestSuite.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolSanityTestSuite.java 2008-12-23 14:17:50 UTC (rev 82527)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.test.aop.classpool.jbosscl.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class JBossClClassPoolSanityTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("UclClassPool All Tests");
+
+ suite.addTest(ClassLoaderWithRepositorySanityTestCase.suite());
+ suite.addTest(ClassLoaderWithModuleDependencySanityTestCase.suite());
+ suite.addTest(ClassLoaderWithPackageDependencySanityTestCase.suite());
+ suite.addTest(ClassLoaderWithReExportModuleSanityTestCase.suite());
+ suite.addTest(ClassLoaderWithReExportPackageSanityTestCase.suite());
+ suite.addTest(ClassLoaderWithUsesPackageSanityTestCase.suite());
+
+ return suite;
+ }
+
+}
Modified: projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTestSuite.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTestSuite.java 2008-12-23 14:01:55 UTC (rev 82526)
+++ projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTestSuite.java 2008-12-23 14:17:50 UTC (rev 82527)
@@ -41,18 +41,8 @@
{
TestSuite suite = new TestSuite("UclClassPool All Tests");
- suite.addTest(ClassLoaderWithRepositorySanityTestCase.suite());
- suite.addTest(ClassLoaderWithModuleDependencySanityTestCase.suite());
- suite.addTest(ClassLoaderWithPackageDependencySanityTestCase.suite());
- suite.addTest(ClassLoaderWithReExportModuleSanityTestCase.suite());
- suite.addTest(ClassLoaderWithReExportPackageSanityTestCase.suite());
- suite.addTest(ClassLoaderWithUsesPackageSanityTestCase.suite());
- suite.addTest(ClassPoolWithRepositoryTestCase.suite());
- suite.addTest(ClassPoolWithModuleDependencyTestCase.suite());
- suite.addTest(ClassPoolWithPackageDependencyTestCase.suite());
- suite.addTest(ClassPoolWithReExportModuleTestCase.suite());
- suite.addTest(ClassPoolWithReExportPackageTestCase.suite());
- suite.addTest(ClassPoolWithUsesPackageTestCase.suite());
+ suite.addTest(JBossClClassPoolSanityTestSuite.suite());
+ suite.addTest(JBossClClassPoolDelegatingTestSuite.suite());
return suite;
}
More information about the jboss-cvs-commits
mailing list