summaryrefslogtreecommitdiffstats
path: root/branches
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-17 09:47:40 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-17 09:47:40 +0000
commit856a24a5ce651aed49b9107f81303df268ba5550 (patch)
treee81e18fd748678d1294c5aa1da51eadb3bf6c2e7 /branches
parent85ea5b2905c9dfcb01b490b0d54dbd70bb475ee2 (diff)
TUSCANY-3312 - change JavaInterface interface reference to a weak reference to avoid this holding onto the interface when stored in the JavaInterfaceFactory cache
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@826212 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches')
-rw-r--r--branches/sca-java-1.5.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/branches/sca-java-1.5.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java b/branches/sca-java-1.5.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
index 194a4a9175..0b418054c5 100644
--- a/branches/sca-java-1.5.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
+++ b/branches/sca-java-1.5.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
@@ -18,6 +18,8 @@
*/
package org.apache.tuscany.sca.interfacedef.java.impl;
+import java.lang.ref.WeakReference;
+
import javax.xml.namespace.QName;
import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
@@ -30,7 +32,7 @@ import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
public class JavaInterfaceImpl extends InterfaceImpl implements JavaInterface {
private String className;
- private Class<?> javaClass;
+ private WeakReference<Class<?>> javaClass;
private Class<?> callbackClass;
private QName qname;
@@ -41,7 +43,7 @@ public class JavaInterfaceImpl extends InterfaceImpl implements JavaInterface {
if (isUnresolved()) {
return className;
} else if (javaClass != null) {
- return javaClass.getName();
+ return javaClass.get().getName();
} else {
return null;
}
@@ -63,11 +65,15 @@ public class JavaInterfaceImpl extends InterfaceImpl implements JavaInterface {
}
public Class<?> getJavaClass() {
- return javaClass;
+ if (javaClass != null){
+ return javaClass.get();
+ } else {
+ return null;
+ }
}
public void setJavaClass(Class<?> javaClass) {
- this.javaClass = javaClass;
+ this.javaClass = new WeakReference<Class<?>>(javaClass);
if (javaClass != null) {
this.className = javaClass.getName();
}
@@ -118,7 +124,7 @@ public class JavaInterfaceImpl extends InterfaceImpl implements JavaInterface {
if (javaClass == null) {
if (other.javaClass != null)
return false;
- } else if (!javaClass.equals(other.javaClass))
+ } else if (!javaClass.get().equals(other.javaClass.get()))
return false;
if (callbackClass == null) {
if (other.callbackClass != null)