From 4c7135a02179116fa07dd11df28a7885f5369273 Mon Sep 17 00:00:00 2001 From: slaws Date: Tue, 13 Apr 2010 18:50:44 +0000 Subject: TUSCANY-3533 - break the loop of CLMR through contribution to the components an the implementations themselves that are loaded by CLMR git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@933740 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/contribution/java/impl/ClassLoaderModelResolver.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sca-java-2.x/trunk') diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java index 86146fc31b..955bb82ce4 100644 --- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java +++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java @@ -20,6 +20,7 @@ package org.apache.tuscany.sca.contribution.java.impl; import java.io.IOException; +import java.lang.ref.WeakReference; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; @@ -45,7 +46,7 @@ import org.apache.tuscany.sca.extensibility.ServiceDiscovery; * @version $Rev$ $Date$ */ public class ClassLoaderModelResolver extends URLClassLoader implements ModelResolver { - private Contribution contribution; + private WeakReference contribution; private ProcessorContext context; private Map importResolvers = new HashMap(); @@ -70,10 +71,10 @@ public class ClassLoaderModelResolver extends URLClassLoader implements ModelRes public ClassLoaderModelResolver(final Contribution contribution, FactoryExtensionPoint modelFactories) throws IOException { super(getContributionURLs(contribution), parentClassLoader(contribution)); - this.contribution = contribution; + this.contribution = new WeakReference(contribution); // Index Java import resolvers by package name Map> resolverMap = new HashMap>(); - for (Import import_: this.contribution.getImports()) { + for (Import import_: this.contribution.get().getImports()) { if (import_ instanceof JavaImport) { JavaImport javaImport = (JavaImport)import_; List resolvers = resolverMap.get(javaImport.getPackage()); -- cgit v1.2.3