It seems like JacksonBinder is not thread-safe. However, this Binder is
being automatically added to all Jersey Clients and any two threads
accessing the client at the same time may trigger the bind method, which
may fail with:
java.lang.IllegalArgumentException: Recursive configuration call detected.
at
org.glassfish.hk2.utilities.binding.AbstractBinder.bind(AbstractBinder.java:179)
at
org.glassfish.jersey.model.internal.CommonConfig.configureBinders(CommonConfig.java:676)
at
org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:641)
at
org.glassfish.jersey.client.ClientConfig$State.configureMetaProviders(ClientConfig.java:372)
at
org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:405)
at
org.glassfish.jersey.client.ClientConfig$State.access$000(ClientConfig.java:90)
at
org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:122)
at
org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:119)
at
org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:340)
at
org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:733)
at
org.glassfish.jersey.client.ClientRequest.getConfiguration(ClientRequest.java:286)
at
org.glassfish.jersey.client.JerseyInvocation.validateHttpMethodAndEntity(JerseyInvocation.java:135)
at
org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:105)
at
org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:101)
at
org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:92)
at
org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:420)
at
org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:316)
Normally, this wouldn't happen, but in my case I need to register a new
Filter on each thread and I think that triggers the Client configuration to
be copied, except the JacksonBinder instance will still be shared between
the two configurations.
I posted the following question on SO describing my issue in more detail:
http://stackoverflow.com/questions/43528247/jersey-webtarget-thread-safety
What do you think?
Thanks!
--
You received this message because you are subscribed to the Google Groups
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.