In org.apache.cxf.endpoint.ClientImpl.invoke() method, it reuses the existing ResponseContext of current thread from its WeakHashMap. It can cause the ConcurrentModificationException if the proxy client use an Executor to execute an asyc request.
Thread 1. We call the async request method of generated proxy client, it will call JaxWsClientProxy.invokeAsync(), and it will get the previous ResponseContext of current thread and clear it and reuse it in ClientImpl.
Thread 2, When CXF got the response from the server, it will use a background thread to process the response, and also it will get the ResponseContext and process the response in ClientImpl
Since the ResponseContext in Thread 2 could be clean by the Thread 1 during processing the response message, so it could cause ConcurrentModificationException, or it can cause data error.
Could you please fix it by creating a new ResponseContext for the new request? thanks.