You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2011/08/15 10:44:25 UTC

svn commit: r1157738 - in /axis/axis2/java/core/branches/1_6: ./ modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java

Author: veithen
Date: Mon Aug 15 08:44:25 2011
New Revision: 1157738

URL: http://svn.apache.org/viewvc?rev=1157738&view=rev
Log:
AXIS2-5062: Merged r1157517 and r1157535 to the 1.6 branch.

Modified:
    axis/axis2/java/core/branches/1_6/   (props changed)
    axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
    axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java

Propchange: axis/axis2/java/core/branches/1_6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug 15 08:44:25 2011
@@ -1 +1 @@
-/axis/axis2/java/core/trunk:1068985,1069659,1069898,1070439,1072077,1072271,1072296,1072499,1072510,1075057,1078242,1081563,1081587,1081590,1082316,1082322,1082600,1082702,1082726,1082738,1083180,1083192,1083379,1083381,1083425,1083433,1083446,1084753,1085157,1085173,1085514,1085889,1085927,1085931,1087073,1088239,1088248-1088249,1088251,1088268,1088730,1088904,1089225,1089989,1090429,1090457,1091178,1091191,1094117,1096530,1096557,1099385,1099389,1100628,1101037,1103013,1103336,1103606,1103760,1128580,1128584,1128618,1128645,1130590,1131425,1134438,1134616,1136156,1136159,1136177,1137153,1137159,1138144,1138203,1139448,1139484,1156305,1156382,1157501,1157522
+/axis/axis2/java/core/trunk:1068985,1069659,1069898,1070439,1072077,1072271,1072296,1072499,1072510,1075057,1078242,1081563,1081587,1081590,1082316,1082322,1082600,1082702,1082726,1082738,1083180,1083192,1083379,1083381,1083425,1083433,1083446,1084753,1085157,1085173,1085514,1085889,1085927,1085931,1087073,1088239,1088248-1088249,1088251,1088268,1088730,1088904,1089225,1089989,1090429,1090457,1091178,1091191,1094117,1096530,1096557,1099385,1099389,1100628,1101037,1103013,1103336,1103606,1103760,1128580,1128584,1128618,1128645,1130590,1131425,1134438,1134616,1136156,1136159,1136177,1137153,1137159,1138144,1138203,1139448,1139484,1156305,1156382,1157501,1157517,1157522,1157535

Modified: axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java?rev=1157738&r1=1157737&r2=1157738&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java Mon Aug 15 08:44:25 2011
@@ -180,4 +180,25 @@ public class SOAPMessageDispatchTests ex
         response.writeTo(System.out);
     }
 
+    /**
+     * Tests that HTTP connections are properly released if {@link Dispatch#invokeOneWay(Object)} is
+     * used to invoke a service that actually uses the in-out MEP. This is a regression test for
+     * AXIS2-5062.
+     * 
+     * @throws Exception
+     */
+    public void testConnectionReleaseForInvokeOneWayWithMEPMismatch() throws Exception {
+        Service svc = Service.create(serviceName);
+        svc.addPort(portName, null, url);
+        Dispatch<SOAPMessage> dispatch = svc.createDispatch(portName,
+                                                            SOAPMessage.class, Service.Mode.MESSAGE);
+        MessageFactory factory = MessageFactory.newInstance();
+        SOAPMessage message = factory.createMessage();
+        message.getSOAPBody().addBodyElement(new QName("urn:test", "test"));
+        // If HTTP connections are not properly released, then this will end up with a
+        // ConnectionPoolTimeoutException.
+        for (int i=0; i<200; i++) {
+            dispatch.invokeOneWay(message);
+        }
+    }
 }

Modified: axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java?rev=1157738&r1=1157737&r2=1157738&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java Mon Aug 15 08:44:25 2011
@@ -450,6 +450,7 @@ public abstract class BaseDispatch<T> ex
     public void invokeOneWay(Object obj) throws WebServiceException {
 
         // All exceptions are caught and rethrown as a WebServiceException
+        MessageContext requestMsgCtx = null;
         try {
             if (log.isDebugEnabled()) {
                 log.debug("Entered one-way invocation: BaseDispatch.invokeOneWay()");
@@ -462,7 +463,7 @@ public abstract class BaseDispatch<T> ex
 
             // Create the MessageContext to hold the actual request message and its
             // associated properties
-            MessageContext requestMsgCtx = new MessageContext();
+            requestMsgCtx = new MessageContext();
             requestMsgCtx.getAxisMessageContext().setProperty(BINDING_PROVIDER, this);
             requestMsgCtx.setEndpointDescription(getEndpointDescription());
             invocationContext.setRequestMessageContext(requestMsgCtx);
@@ -550,6 +551,18 @@ public abstract class BaseDispatch<T> ex
                         " Exception caught: ", e);
             }
             throw ExceptionFactory.makeWebServiceException(e);
+        } finally {
+            // In all other cases we rely on freeInputStream to perform the clean up. Since we don't expect
+            // a response in the invokeOneWay case, we need to perform call TransportSender#cleanup explicitly
+            try {
+                if (requestMsgCtx != null && requestMsgCtx.getAxisMessageContext() != null) {
+                    org.apache.axis2.context.MessageContext axisMsgCtx = requestMsgCtx.getAxisMessageContext();
+                    if (axisMsgCtx.getTransportOut() != null && axisMsgCtx.getTransportOut().getSender() != null) {
+                        axisMsgCtx.getTransportOut().getSender().cleanup(axisMsgCtx);
+                    }
+                }
+            } catch (Exception ignore) {
+            }
         }
     }