From 685e0996023a229894a43185d3da8a8f0e148669 Mon Sep 17 00:00:00 2001 From: slaws Date: Wed, 21 Oct 2009 16:27:30 +0000 Subject: 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 --- .../main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'branches/sca-java-1.5.2/modules/core') 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(); + private static WeakHashMap cache = new WeakHashMap(); 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 }); -- cgit v1.2.3