tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r826212 - /tuscany/branches/sca-java-1.5.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
Date Sat, 17 Oct 2009 09:47:40 GMT
Author: slaws
Date: Sat Oct 17 09:47:40 2009
New Revision: 826212

URL: http://svn.apache.org/viewvc?rev=826212&view=rev
Log:
TUSCANY-3312 - change JavaInterface interface reference to a weak reference to avoid this
holding onto the interface when stored in the JavaInterfaceFactory cache

Modified:
    tuscany/branches/sca-java-1.5.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java

Modified: tuscany/branches/sca-java-1.5.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java?rev=826212&r1=826211&r2=826212&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
(original)
+++ tuscany/branches/sca-java-1.5.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
Sat Oct 17 09:47:40 2009
@@ -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 @@
 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 @@
         if (isUnresolved()) {
             return className;
         } else if (javaClass != null) {
-            return javaClass.getName();
+            return javaClass.get().getName();
         } else {
             return null;
         }
@@ -63,11 +65,15 @@
     }
 
     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 @@
             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)



Mime
View raw message