This is an automated email from the ASF dual-hosted git repository.
robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git
The following commit(s) were added to refs/heads/master by this push:
new d663fc5038 AXIS2-6030 Axis2 connections are not returned to connection
pool on 1.8.0 with JAXWS
d663fc5038 is described below
commit d663fc5038d2eeb85c63108cf17b59fcd34e8be7
Author: Robert Lazarski <[email protected]>
AuthorDate: Mon Feb 10 18:04:26 2025 -1000
AXIS2-6030 Axis2 connections are not returned to connection pool on 1.8.0
with JAXWS
---
.../jaxws/client/proxy/JAXWSProxyHandler.java | 26 ++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git
a/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
b/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
index e2d8b359b4..e33262eda4 100644
---
a/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
+++
b/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
@@ -58,6 +58,7 @@ import jakarta.xml.ws.Response;
import jakarta.xml.ws.WebServiceException;
import jakarta.xml.ws.WebServiceFeature;
import jakarta.xml.ws.soap.SOAPBinding;
+import java.io.InputStream;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -65,6 +66,8 @@ import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
+import java.util.Iterator;
+import java.util.Map;
/**
* ProxyHandler is the java.lang.reflect.InvocationHandler implementation.
When a JAX-WS client
@@ -567,6 +570,7 @@ public class JAXWSProxyHandler extends BindingProvider
implements
// Free incoming stream
try {
responseContext.freeInputStream();
+ closeInputStream(responseContext);
}
catch (Throwable t) {
throw ExceptionFactory.makeWebServiceException(t);
@@ -574,6 +578,28 @@ public class JAXWSProxyHandler extends BindingProvider
implements
}
}
+ private void closeInputStream(MessageContext responseContext) {
+ // accessing the input stream is not possible via get
+ // workaround using entry set
+ Iterator var2 = responseContext.getMEPContext().entrySet().iterator();
+
+ while(var2.hasNext()) {
+ Object entry = var2.next();
+ if (entry instanceof Map.Entry &&
"TRANSPORT_IN".equals(((Map.Entry)entry).getKey())) {
+ Object prop = ((Map.Entry)entry).getValue();
+ if (prop instanceof InputStream) {
+ try {
+ InputStream inputStream = (InputStream)prop;
+ inputStream.close();
+ } catch (Exception var6) {
+ log.error(var6.getMessage(), var6);
+ }
+ }
+ break;
+ }
+ }
+ }
+
protected static Throwable getFaultResponse(MessageContext msgCtx,
OperationDescription opDesc) {
Message msg = msgCtx.getMessage();