RestEasy 4.7.9 - java.lang.IllegalStateException: Connection pool shutdown
by Zsolt Melich
Hi all!
I hope I raise this thread in the correct list. If I don't ,please let me know.
I'm facing with the error message in the subject since I had to switch from RestEasy v3.0.18 (I know, quite old) to v4.7.9.
We have a great, complex IVR application (written in Java 8), what is using RestEasy in the WS client we have for the API calls throughout a calls (there are many). The application is deployed to a Tomcat 9 application server.
The current version of the client creates a RestEasy client instance, then close the response and the client (with the close() method) for each API invocation. This is quite ineffective and expensive, so I planned to change this when I switch to v4.7.9.
In the new version I create the client at the beginning, closing the response (to let the resource back to the pool) after each invocation, and shut down the client with close() at the very end (only once).
We create the PoolingHttpClientConnectionManager instance, the engine instance (ApacheHttpClient43Engine) and the httpClient instance manually, then we pass the engine to the ClientBuilder to create the client instance.
The problem is that I can make only one IVR test call without any issue. At the very end of the first call, the connection is being closed. In the second call I got the exception from the subject for the very first API call.
I checked the logs, traced my test calls and everything is looking fine (the app does not close the connection before the invocation). After a Tomcat restart I'm able to do a successful test call again, but only for one time! After a successful call, I'm getting the same exception in the next call...
Does the close() method of the client instance destroy the whole connection pool for later calls as well when I close the connection at the end of the first call? Is this normal?
We didn't have this issue with v.3.0.18.
P.S. : I know I haven't provided any exact code yet, but I try to clarify and understand the mechanics first.
Thanks for the helping replies in advance!
1 year, 4 months