users@jersey.java.net

[Jersey] Thread and Performance Considerations of Jersey Client 2.x

From: John Zajac <jzajac_at_expedia.com>
Date: Wed, 30 Oct 2013 10:21:35 -0700

In a nutshell, what are they?

The 2.x api doc and user guide seem to be silent on the topic. Specifically, I want be able invoke other Restful services from the implementation of another (i.e. from multiple threads) in an efficient manner without unnecessarily regenerating client or targets etc. but of course safely . Googling so far has yielded some advice and comments, mostly for Jersey 1.x, but nothing official for 2.x and not something that is necessarily going to remain true over time for future releases of Jersey.

I have started looking at the source to determine what can be considered thread safe (e.g. maybe the client), or whether it I need to use a pool for 'serial' re-use), and what must be created for each request (e.g. the builder returned by WebTarget.request(String). However, would like some to see what behavior can be depended on across releases.

It would be nice if the jersey user guide could be updated with something along the lines of how jaxb addresses the subject (https://jaxb.java.net/guide/Performance_and_thread_safety.html).

Anyone been down this road already?