tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <>
Subject Re: Thread Safety with and CDI
Date Tue, 25 Oct 2016 07:29:05 GMT
Hi Karl,

The question is IMHO why do you need it to be thread safe? I'll take a
simple example: a Map. You can choose a HashMap or ConcurrenHashMap for
instance. A HashMap is fine at runtime until you modify it. This is the
same for the Client. If you don't modify its configuration you are safe.

I think you could keep a single reference of Client (you rarely call
register or property at runtime). It is almost the same for WebTarget until
you set parameters (from this point you need to use a new instance per call
without setting the thread safe property (

Romain Manni-Bucau
@rmannibucau <> |  Blog
<> | Old Wordpress Blog
<> | Github <> |
LinkedIn <> | Tomitriber
<> | JavaEE Factory

2016-10-25 9:17 GMT+02:00 Karl Kildén <>:

> Hello!
> I read about it but I would just like to make sure...
> RSClientAPI-ThreadSafety
> If I have a CDI @ApplicationScoped bean called Fetcher that creates the
> Client in @PostConstruct. When I use the Fetcher from multiple threads the
> Client instance itself will not be a CDI proxy (All though maybe CXF has
> some kind of proxy impl).
> Is this safe/ good practice? Perhaps I should produce a single
> @ApplicationScoped Client for all my Fetchers if it indeed is thread
> safe...
> Any advice would be great
> Cheers

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message