Browse Source

remove world reuse - needs more thought

tags/V1_8_13
Andy Clement 6 years ago
parent
commit
9ab77b622c

+ 20
- 19
org.aspectj.matcher/src/org/aspectj/weaver/reflect/ReflectionWorld.java View File

@@ -43,25 +43,26 @@ public class ReflectionWorld extends World implements IReflectionWorld {
private Map<String,Class<?>> inProgressResolutionClasses = new HashMap<String,Class<?>>();
public static ReflectionWorld getReflectionWorldFor(WeakClassLoaderReference classLoaderReference) {
synchronized (rworlds) {
// Tidyup any no longer relevant entries...
for (Iterator<Map.Entry<WeakClassLoaderReference, ReflectionWorld>> it = rworlds.entrySet().iterator();
it.hasNext();) {
Map.Entry<WeakClassLoaderReference, ReflectionWorld> entry = it.next();
if (entry.getKey().getClassLoader() == null) {
it.remove();
}
}
ReflectionWorld rworld = null;
if (classLoaderReference.getClassLoader() != null) {
rworld = rworlds.get(classLoaderReference);
if (rworld == null) {
rworld = new ReflectionWorld(classLoaderReference);
rworlds.put(classLoaderReference, rworld);
}
}
return rworld;
}
return new ReflectionWorld(classLoaderReference);
// synchronized (rworlds) {
// // Tidyup any no longer relevant entries...
// for (Iterator<Map.Entry<WeakClassLoaderReference, ReflectionWorld>> it = rworlds.entrySet().iterator();
// it.hasNext();) {
// Map.Entry<WeakClassLoaderReference, ReflectionWorld> entry = it.next();
// if (entry.getKey().getClassLoader() == null) {
// it.remove();
// }
// }
// ReflectionWorld rworld = null;
// if (classLoaderReference.getClassLoader() != null) {
// rworld = rworlds.get(classLoaderReference);
// if (rworld == null) {
// rworld = new ReflectionWorld(classLoaderReference);
// rworlds.put(classLoaderReference, rworld);
// }
// }
// return rworld;
// }
}
public static void cleanUpWorlds() {

+ 2
- 2
weaver/testsrc/org/aspectj/weaver/tools/PointcutDesignatorHandlerTests.java View File

@@ -66,7 +66,7 @@ public class PointcutDesignatorHandlerTests extends TestCase {
* InternalUseOnlyPointcutParser inside the Java15ReflectionBasedReferenceTypeDelegate code. First test checks
* parsing is OK
*/
public void xtestParsingBeanInReferencePointcut01() throws Exception {
public void testParsingBeanInReferencePointcut01() throws Exception {
if (needToSkip) return;
PointcutParser parser = PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingContextClassloaderForResolution();
BeanDesignatorHandler beanHandler = new BeanDesignatorHandler();
@@ -87,7 +87,7 @@ public class PointcutDesignatorHandlerTests extends TestCase {
* InternalUseOnlyPointcutParser inside the Java15ReflectionBasedReferenceTypeDelegate code. This test checks the
* actual matching.
*/
public void xtestParsingBeanInReferencePointcut02() throws Exception {
public void testParsingBeanInReferencePointcut02() throws Exception {
if (needToSkip) return;
PointcutParser parser = PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingContextClassloaderForResolution();
BeanDesignatorHandler beanHandler = new BeanDesignatorHandler();

Loading…
Cancel
Save