-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JAX-RS / Jackson Thread Safety w/ThreadLocal #32
Conversation
Just to be sure: the point here would be to make Also: I think it would make sense to add this as a feature; I know that it is not a big change, but I suspect some users could be uncomfortable adding more things in context. |
Thanks for the quick response, @cowtowncoder! Agree - I am not 100% comfortable with TheadLocal implementation myself, but any cleaner alternative would involve a fairly significant refactor to com.fasterxml.jackson.jaxrs.base.ProviderBase. Thoughts? |
I am actually fine with But I can make those changes myself afterwards; so let me think about this for a bit, and go ahead. One more thing I need to ask is Contributor License Agreement. It's the standard thing we have to ask from all (new) contributors: https://github.com/FasterXML/jackson/blob/master/contributor-agreement.pdf and one is enough for all contributions. Would it be possible to fill that out, scan and email to us (info at fasterxml.com)? It can be personal one (leaving company empty), or employer-specific one; most contributors do former. CLA itself is from Sun so hopefully there is nothing unusual there -- we just need it to distribute code. Apologies if I have already gotten one: list of CLAs we have is long and sometimes I forget who has already sent one. :) |
Oh - I understand now...
|
Hmmh. Ok, after re-reading the code I realized I hadn't quite understood the order of things; and had assumed reverse relationship of provider exposing Writer (and/or Reader). But that wouldn't work with filters, so code makes sense. I think I can improve on merging part a bit: I think it is possible to actually assume that |
Hmmh. Ok, after reworking this and checking it in, I realized that I have one fundamental flaw in my thinking. But trying to merge readers and writers is nasty business; so what I am wondering, rather, is whether we could and should use some other abstraction. For example, a configuration object used for (re)configuring what endpoint has. The problem is that filter does not have access to end point (to obtain baseline to modify); and endpoint only gets control once filter is done. |
Ok. I think I have a better idea. Instead of trying to build a configuration object of some sort, it is better to have a "Reader modifier" and "Writer modifier" objects that can be registered on per-request basis. These take fully set up Registration itself can be passed using Would this make sense? |
Created #32 for what I think is the gisat of request here, implemented. Please let me know if that solution would work for your use case? |
This is a follow-up to the forum post here: http://jackson-users.ning.com/forum/topics/jax-rs-jacksonjsonprovider-thread-safety-issues?commentId=5286555%3AComment%3A29197
Provided a very simple ThreadLocal-based solution for accessing the in context JAX-RS ObjectWriter.