-
Notifications
You must be signed in to change notification settings - Fork 155
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
Deadlock in REST.java #127
Comments
FYI - I took the synchorized (mutex) lines out of REST.java and it seems to be working fine now. I do a lot of caching in my gallery code, so the REST.java is not called all that much really. I'm sure there was a reason to synchronize that code, but I'm just not sure what it was. I would still like to understand that if anyone else knows. Thanks! |
Hi, it looks like the DocumentBuilder is not thread-safe hence the synchronization. I don't get much time to work on this project at the moment but suggest that you might want to instantiate a DocumentBuilder within the method if you decide to take out the mutex wrapper. |
Thanks so much for the advice! I modified the code as you suggested. Is it ok to just have one instance of DocumentBuilderFactory, or should I do a new instance of that each time as well? |
It looks like it's also not thread-safe so don't set one as a field either, just keep it a local variable. |
Ok, thanks again for the help! |
Hello and thanks so much for the great library. I know you said that it is not thread safe, but do you have any ideas on how I can make it so? It's very strange because I've been using the library for around a year with no problems. Now, all of a sudden I'm getting these deadlocks in REST.java where it is synchronizing on the mutex object. I tried synchronizing the whole method, but no luck. Hopefully someone smarter than myself can give me a little advice.
Thanks!
PS - I'm running my gallery on Tomcat in Linux with Java 7.
The text was updated successfully, but these errors were encountered: