Author: midon
Date: Tue Mar  3 23:49:14 2009
New Revision: 749847

URL: http://svn.apache.org/viewvc?rev=749847&view=rev
Log:
ODE-533: not releasing the conn is bad, releasing too early as well

Modified:
    
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java

Modified: 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java?rev=749847&r1=749846&r2=749847&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
 Tue Mar  3 23:49:14 2009
@@ -180,26 +180,23 @@
                         _executorService.submit(new Callable<Object>() {
                             public Object call() throws Exception {
                                 try {
-                                    try {
-                                        operationClient.execute(true);
-                                    } finally {
-                                        // make sure the HTTP connection is 
released to the pool!
-                                        
mctx.getTransportOut().getSender().cleanup(mctx);
-                                    }
+                                    operationClient.execute(true);
                                     MessageContext response = 
operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                                     MessageContext flt = 
operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_FAULT_VALUE);
                                     if (response != null && 
__log.isDebugEnabled())
                                         __log.debug("Service response:\n" + 
response.getEnvelope().toString());
 
                                     if (flt != null) {
-                                        reply(mexId, operation, flt, true);
+                                        reply(mexId, operation, flt, true, 
mctx);
                                     } else {
-                                        reply(mexId, operation, response, 
response.isFault());
+                                        reply(mexId, operation, response, 
response.isFault(), mctx);
                                     }
                                 } catch (Throwable t) {
+                                    // release the HTTP connection, we don't 
need it anymore
+                                    
mctx.getTransportOut().getSender().cleanup(mctx);
                                     String errmsg = "Error sending message 
(mex=" + odeMex + "): " + t.getMessage();
                                     __log.error(errmsg, t);
-                                    replyWithFailure(mexId, 
MessageExchange.FailureType.COMMUNICATION_ERROR, errmsg, null);
+                                    replyWithFailure(mexId, 
MessageExchange.FailureType.COMMUNICATION_ERROR, errmsg);
                                 }
                                 return null;
                             }
@@ -425,14 +422,13 @@
         return _serviceName;
     }
 
-    private void replyWithFailure(final String odeMexId, final FailureType 
error, final String errmsg,
-                                  final Element details) {
+    private void replyWithFailure(final String odeMexId, final FailureType 
error, final String errmsg) {
         // ODE MEX needs to be invoked in a TX.
         try {
             _sched.execIsolatedTransaction(new Callable<Void>() {
                 public Void call() throws Exception {
                     PartnerRoleMessageExchange odeMex = 
(PartnerRoleMessageExchange) _server.getEngine().getMessageExchange(odeMexId);
-                    odeMex.replyWithFailure(error, errmsg, details);
+                    odeMex.replyWithFailure(error, errmsg, null);
                     return null;
                 }
             });
@@ -445,7 +441,7 @@
 
     }
 
-    private void reply(final String odeMexId, final Operation operation, final 
MessageContext reply, final boolean isFault) {
+    private void reply(final String odeMexId, final Operation operation, final 
MessageContext reply, final boolean isFault, final MessageContext 
outMsgContext) {
         // ODE MEX needs to be invoked in a TX.
         try {
             _sched.execIsolatedTransaction(new Callable<Void>() {
@@ -487,6 +483,9 @@
                         String errmsg = "Unable to process response: " + 
ex.getMessage();
                         __log.error(errmsg, ex);
                         odeMex.replyWithFailure(FailureType.OTHER, errmsg, 
null);
+                    }finally{
+                        // make sure the HTTP connection is released to the 
pool!
+                        
outMsgContext.getTransportOut().getSender().cleanup(outMsgContext);
                     }
                     return null;
                 }


Reply via email to