Skip to content
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

Threading issue with parsing/serializing classes on separate threads #134

Open
pmecho opened this issue Jan 22, 2016 · 4 comments
Open

Threading issue with parsing/serializing classes on separate threads #134

pmecho opened this issue Jan 22, 2016 · 4 comments

Comments

@pmecho
Copy link

pmecho commented Jan 22, 2016

I've come across a peculiar threading issue. It seems that parsing an object of Class X while serializing a separate object of Class X on a separate thread can cause data inconsistencies with the parsed object. I've created a sample app that demonstrates said issue.

Parsing and serializing objects of the same class should be allowed on separate threads at the same time. The use case for this functionality is parsing JSON from a database read while serializing JSON from a network response to be saved to the database.

Let me know if you need further info.
ThreadingIssue.zip

@molikto
Copy link

molikto commented Mar 10, 2016

@EricKuck I looked at the ThreadingIssue code and also done a quick search for SimpleDateFormat in your project. And I think it is because you reused SimpleDateFormat across threads, use ThreadLocal<SimpleDateFormat> instread https://github.com/bluelinelabs/LoganSquare/blob/e28ac1b19b939a46665ffeb45c2b09a16afc1ef8/core/src/main/java/com/bluelinelabs/logansquare/typeconverters/DefaultDateFormatter.java

@molikto
Copy link

molikto commented Mar 10, 2016

Is this library maintained or not? why this issue is not answered

@EricKuck
Copy link
Member

Yes, it's maintained. It's not, however my full time job. Nor am I under any obligation to answer until I've had time to look at issues. Pull requests are welcome. Implying that I owe it to people to drop what I'm doing and answer questions right away is not. The point of open source is that others are able to contribute.

That being said, I'll try to have a solution for this ready by the end of the day.

@EricKuck
Copy link
Member

@Smpete Sorry for the wait and thanks for the sample project. I've fixed the issue and will be pushing an update shortly (gotta fix a few other things first. I'll keep you posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants