diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-13 18:50:44 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-13 18:50:44 +0000 |
commit | 4c7135a02179116fa07dd11df28a7885f5369273 (patch) | |
tree | 34e9af07b5892c4a257f3690586051e689fd6f3c /sca-java-2.x/trunk/modules/contribution/src | |
parent | 16d457a6341b145f1781babdf30fb77300378454 (diff) |
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
Diffstat (limited to '')
-rw-r--r-- | sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java | 7 |
1 files changed, 4 insertions, 3 deletions
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> contribution; private ProcessorContext context; private Map<String, ModelResolver> importResolvers = new HashMap<String, ModelResolver>(); @@ -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>(contribution); // Index Java import resolvers by package name Map<String, List<ModelResolver>> resolverMap = new HashMap<String, List<ModelResolver>>(); - for (Import import_: this.contribution.getImports()) { + for (Import import_: this.contribution.get().getImports()) { if (import_ instanceof JavaImport) { JavaImport javaImport = (JavaImport)import_; List<ModelResolver> resolvers = resolverMap.get(javaImport.getPackage()); |