users@jersey.java.net

[Jersey] Thread-safety of client connector implementations

From: algermissen1971 <algermissen1971_at_mac.com>
Date: Wed, 25 Sep 2013 12:14:08 +0200

Hi,

I assume that all Jersey client connector implementations (URLConnection, Grizzly, Apache) are thread safe in the sense that one can share a single Client instance across threads for WebTarget creation and request invocation on such targets.

Depending on the internal connection management of the individual connectors (or their configuration) one might experience serialization of concurrent threads during request invocations.

Bottom line: I can use a single Jersey Client instance in a JavaEE application without needing to worry about concurrent access to that Client instance. My concurrency needs regarding request invocations I need to address by connector choice and configuration.

All of the above actually violates the idea that connections and threads must be managed by the EE container only. But there is no way around that violation anyhow, because there is no sensible way to hook an HTTP client into a container using JCA (at least this is what I read from the mailing lists out there).

Correct?

Jan