cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1295937 - in /cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/
Date Thu, 01 Mar 2012 22:10:05 GMT
Author: dkulp
Date: Thu Mar  1 22:10:04 2012
New Revision: 1295937

URL: http://svn.apache.org/viewvc?rev=1295937&view=rev
Log:
[CXF-4149] Hold onto dispatch and proxy to make sure it isn't garbage
collected and destroyed prior to the response coming back.

Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsClientCallback.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?rev=1295937&r1=1295936&r2=1295937&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Thu Mar
 1 22:10:04 2012
@@ -394,7 +394,7 @@ public class DispatchImpl<T> implements 
         checkError();
         client.setExecutor(getClient().getEndpoint().getExecutor());
 
-        ClientCallback callback = new JaxwsClientCallback<T>(asyncHandler);
+        ClientCallback callback = new JaxwsClientCallback<T>(asyncHandler, this);
              
         Response<T> ret = new JaxwsResponseCallback<T>(callback);
         try {

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java?rev=1295937&r1=1295936&r2=1295937&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java Thu
Mar  1 22:10:04 2012
@@ -257,7 +257,7 @@ public class JaxWsClientProxy extends or
         } else {
             handler = null;
         }
-        ClientCallback callback = new JaxwsClientCallback<Object>(handler);
+        ClientCallback callback = new JaxwsClientCallback<Object>(handler, this);
              
         Response<Object> ret = new JaxwsResponseCallback<Object>(callback);
         client.invoke(callback, oi, params);

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsClientCallback.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsClientCallback.java?rev=1295937&r1=1295936&r2=1295937&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsClientCallback.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsClientCallback.java
Thu Mar  1 22:10:04 2012
@@ -31,9 +31,11 @@ import org.apache.cxf.endpoint.ClientCal
 
 class JaxwsClientCallback<T> extends ClientCallback {
     final AsyncHandler<T> handler;
+    final Object proxy;
     
-    public JaxwsClientCallback(final AsyncHandler<T> handler) {
+    public JaxwsClientCallback(final AsyncHandler<T> handler, Object p) {
         this.handler = handler;
+        this.proxy = p;
     }
     public void handleResponse(Map<String, Object> ctx, Object[] res) {
         context = ctx;

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=1295937&r1=1295936&r2=1295937&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
(original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Thu Mar  1 22:10:04 2012
@@ -383,6 +383,29 @@ public class ClientServerTest extends Ab
             throw (Exception)ex.getCause();
         }
     } 
+    
+    @Test
+    public void testAsyncDiscardProxy() throws Exception {
+        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
+        assertNotNull(wsdl);
+        
+        SOAPService service = new SOAPService(wsdl, serviceName);
+        
+        assertNotNull(service);
+        
+        Greeter greeter = service.getPort(portName, Greeter.class);
+        
+        assertNotNull(service);
+        updateAddressPort(greeter, PORT);
+
+        Response<GreetMeLaterResponse> r1 = greeter.greetMeLaterAsync(3000);
+        greeter = null;
+        service = null;
+        System.gc();
+        System.gc();
+        System.gc();
+        assertEquals("Hello, finally!", r1.get().getResponseType());
+    }
 
     @Test
     public void testAsyncPollingCall() throws Exception {



Mime
View raw message