summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.5.2/modules/core
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-21 16:27:30 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-21 16:27:30 +0000
commit685e0996023a229894a43185d3da8a8f0e148669 (patch)
treefc7f6c050eddeac5ac605cad5e0d73617ab69789 /branches/sca-java-1.5.2/modules/core
parentce8ce56837922f872e9ba6ffb1d4ef35cf85d88f (diff)
TUSCANY-3312 remove circular references where a class is used as the key of a map and the value of the map also references the class. The weakness of the map never comes into play as there is always a reference to the key (held by the value). This all pins the app classloader and causes a leak on each app start/stop cycle
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@828086 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.5.2/modules/core')
-rw-r--r--branches/sca-java-1.5.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/branches/sca-java-1.5.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java b/branches/sca-java-1.5.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java
index 1112d02b7e..b591ccedd6 100644
--- a/branches/sca-java-1.5.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java
+++ b/branches/sca-java-1.5.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java
@@ -33,7 +33,7 @@ public class SCAProxy extends Proxy
// This is a cache containing the proxy class constructor for each business interface.
// This improves performance compared to calling Proxy.newProxyInstance()
// every time that a proxy is needed.
- private static WeakHashMap cache = new WeakHashMap<Class, Object>();
+ private static WeakHashMap cache = new WeakHashMap<String, Object>();
public static Object newProxyInstance(ClassLoader classloader, Class aclass[], InvocationHandler invocationhandler)
throws IllegalArgumentException
@@ -44,13 +44,13 @@ public class SCAProxy extends Proxy
// Lookup cached constructor. aclass[0] is the reference's business interface.
Constructor proxyCTOR;
synchronized(cache) {
- proxyCTOR = (Constructor) cache.get(aclass[0]);
+ proxyCTOR = (Constructor) cache.get(aclass[0].hashCode());
}
if(proxyCTOR == null) {
Class proxyClass = getProxyClass(classloader, aclass);
proxyCTOR = proxyClass.getConstructor(constructorParams);
synchronized(cache){
- cache.put(aclass[0],proxyCTOR);
+ cache.put(aclass[0].hashCode(),proxyCTOR);
}
}
return proxyCTOR.newInstance(new Object[] { invocationhandler });