I'd like to clarify.
What happens in this test is
CXF JAXRSClientFactoryBean which represents an individual proxy info is
shared between multiple threads trying to create a single proxy.
This class has never been guaranteed to be thread-safe.
IMHO a pattern where a thread proxy proxy is created/injected early is
what is used most of the time.
However I'll look into the code and see if it can create clients
concurrently. Unfortunately I won't have time to finish it in time for
CXF 3.0.4.
I'll update this thread later on
Thanks, Sergey
On 11/02/15 16:29, Sergey Beryozkin wrote:
Hi Nicola
On 11/02/15 16:08, Nicola Baiocco wrote:
Hi Sergey,
you're right, but when SyncopeClientFactoryBean calls
defaultRestClientFactoryBean sets threadSafe property of
RestClientFactoryBean to true ( line 113 of
SyncopeClientFactoryBean.java ).
That flag affects the actual proxy instance only. The utility
construction code is typically not guaranteed to be thread-safe but as I
said Syncope can make it so if really needed (with synchronized blocks).
Why preparing a proxy with
ResourceService service = syncopeClient.get(ResourceService.class);
first and then invoke concurrently on service.get(),
not acceptable ?
Cheers, Sergey
Kind regards.
Nicola Baiocco | Software Developer
Intesys - Via Roveggia 122 A - 37136 Verona
Tel. 045 503663 | Fax 045 503604
[email protected]
www.intesys.it
Le informazioni contenute nella presente e-mail e nei suoi allegati
potrebbero essere confidenziali/riservate e sono dirette unicamente ai
destinatari sopra indicati. In caso di ricezione da parte di persona
diversa ? vietato qualunque tipo di divulgazione o copia anche
parziale. Chi riceva questo messaggio per errore ? pregato di
inoltrarlo al mittente e di cancellare questa e-mail.
This e-mail and its attachments may contain confidential/reserved
information and is intended only for the use of the address(es) named
above. If the reader of this message is not the intended recipient of
this message, please note that distribution or copying of this
communication is forbidden. Anyone who receives this communication in
error should return it immediately to the sender and delete the message.
-----Messaggio originale-----
Da: Sergey Beryozkin [mailto:[email protected]]
Inviato: mercoledì 11 febbraio 2015 15:03
A: [email protected]
Oggetto: Re: Syncope 1.2.1 client concurrent calls
Hi
SyncopeClient.getService appears to be a construction call and as such
it is not expected to be thread-safe.
Though I guess it can be made thread-safe if preferred but that would
likely imply passing the user name and password to getService() method
too to avoid having cached CXF client factory beans.
The actual CXF proxies (ResourceService, etc) can be made thread safe
too by having a thread safe flag set on them:
http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ThreadSafety
HTH, Sergey
On 11/02/15 11:15, Nicola Baiocco wrote:
Hi all,
we have some problem with multiple cxf calls to Syncope core, seems
that some concurrent problem breaks syncope client calls.
Here a part of the stack trace error:
java.lang.RuntimeException: java.util.ConcurrentModificationException
at
org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.createWithValues(JA
XRSClientFactoryBean.java:341)
~[cxf-rt-rs-client-3.0.2.jar:3.0.2]
at
org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.create(JAXRSClientF
actoryBean.java:264)
~[cxf-rt-rs-client-3.0.2.jar:3.0.2]
at
org.apache.syncope.client.rest.RestClientFactoryBean.createServiceInst
ance(RestClientFactoryBean.java:63)
~[syncope-client-1.2.1.jar:na]
at
org.apache.syncope.client.SyncopeClient.getService(SyncopeClient.java:
95) ~[syncope-client-1.2.1.jar:na]
We've done a unit test to reproduce the problem, you can find it here
(not the real unit test but an adaptable example):
http://apaste.info/iDr
Hope this will help to have major details.
Kind regards.
http://www.intesys.it/firme/logo_intesys.jpg
*Nicola Baiocco**| Software Developer*
Intesys - Via Roveggia 122 A - 37136 Verona Tel. 045 503663 | Fax 045
503604 [email protected] www.intesys.it
<http://www.intesys.it>
Great Place to Work
<http://www.intesys.it/Partecipazione-dei-dipendenti/>Sito a impatto
zero <http://www.intesys.it/Sostenibilita-Ambientale/>
/Le informazioni contenute nella presente e-mail e nei suoi allegati
potrebbero essere confidenziali/riservate e sono dirette unicamente ai
destinatari sopra indicati. In caso di ricezione da parte di persona
diversa è vietato qualunque tipo di divulgazione o copia anche parziale.
Chi riceva questo messaggio per errore è pregato di inoltrarlo al
mittente e di cancellare questa e-mail. /
/This e-mail and its attachments may contain confidential/reserved
information and is intended only for the use of the address(es) named
above. If the reader of this message is not the intended recipient of
this message, please note that distribution or copying of this
communication is forbidden. Anyone who receives this communication in
error should return it immediately to the sender and delete the
message. /