As far as I know, yes, this is the right way to close a Jersey client ... with the following reservations.
1) What you are trying to prevent is not a memory leak, but a connection (to the address you are accessing) of a leak ...
2) The Client section says the following in chapter 3 of the Jersey Handbook
Customer instances are expensive resources. It is recommended that you use a configured instance to create web resources. Building web resources, building queries, and receiving responses ensures thread safety. This way, client instance instances and WebResource instances can be shared across multiple threads.
Therefore, if you plan to make multiple calls, it is not a good idea to call destroy for each call. The same (but to a lesser extent) is true for WebResources.
3) What I am describing is from Jersey 1.1 (but I see topics about it back in 2009 ).
source share