Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.1.6
-
None
-
wildfly-10.1.0
-
Unknown
-
Patch
Description
My app is a web-app and my wildfly has ~ 300 thread. If I understand correctly the code, ClientImpl.responseContext is cleaned only on destroy. We use a lot of service ad some of them have a large output (~10Mb). So, I need a lot of memory for storing ClientImpl.responseContext.
I try the following patch ant it seems to solve the problem, but it has an
horrible cast.
{{
diff --git a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
index 428f79454b..b15fb4dff2 100644
— a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
+++ b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
@@ -29,7 +29,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.WeakHashMap;
+import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.logging.Level;
@@ -96,10 +96,10 @@ public class ClientImpl
protected Map<String, Object> currentRequestContext = new ConcurrentHashMap<String, Object>(8, 0.75f, 4);
protected Map<Thread, EchoContext> requestContext
- = Collections.synchronizedMap(new WeakHashMap<Thread, EchoContext>());
+ = Collections.synchronizedMap(new HashMap<Thread, EchoContext>());
protected Map<Thread, Map<String, Object>> responseContext
- = Collections.synchronizedMap(new WeakHashMap<Thread, Map<String, Object>>());
+ = Collections.synchronizedMap(new HashMap<Thread, Map<String, Object>>());
protected Executor executor;
@@ -1052,5 +1052,8 @@ public class ClientImpl
}
}
-
+ public void releaseLocalThread()
}
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
index d963693afd..37b5e2ed02 100644
— a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
@@ -131,6 +131,7 @@ public class JaxWsClientProxy extends org.apache.cxf.frontend.ClientProxy implem
client.getRequestContext().put(Method.class.getName(), method);
boolean isAsync = isAsync(method);
+ try {
Object result = null;
try {
if (isAsync)
}
return adjustObject(result);
+ } finally
}
boolean isAsync(Method m) {
return m.getName().endsWith("Async")
}}
Luca