Open nithom1 opened 1 month ago
Apparently TypeInfoSetImpl.getXmlNs()
was not designed for concurrent access. A quick and potentially non-performant workaround would be to prevent it by using synchronized
or similar.
I wonder why you need to create a new client every time? Does the clientEndpointUrl
change that often?
No clientEndpointUrl
is changed only once, when its declared. So do you suggest to reuse that client for all threads?
Yes, definitely. You may want to read https://docs.quarkiverse.io/quarkus-cxf/dev/user-guide/first-soap-client.html
I see I need to rebuild the client because the timeout of the soap requests are variable. Is there a other possible Way to archive this without rebuild the client?
I need to rebuild the client
What kind of rebuild do you have on mind? Like change the timeout in application.properties and re-run maven?
because the timeout of the soap requests are variable.
How variable are they? You need to change it at runtime?
The timeout would change at runtime for some kind of request timeout A for other request timeout B. Because of thif i need to rebuild the client for each request.
If you really need to change the client configuration at runtime and there is no way to use some finite set of n clients with n different constant timeouts, then you may consider creating a pool of clients from which you take a client for the given task, make sure it is not used concurrently and as long as it is safeguarded from a concurrent access you may reconfigure it however you want, something like the following:
MyService clientProxy = pool.acquire();
try {
Client client = ClientProxy.getClient(clientProxy);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = http.getClient();
httpClientPolicy.setConnectionTimeout(...);
httpClientPolicy.setReceiveTimeout(...);
clientProxy.hello("World")
} finally {
pool.release(clientProxy);
}
When using this following code (A). Sometimes (possibly under highload) I get the mentioned ConcurrentModificationException (B). What do iam wrong, when using the section (A) on serveral several threads? Using
io.quarkiverse.cxf:quarkus-cxf:4.0.4
(A)
In the last line the Exception (B) is throwed
(B)