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

SimpleDateFormat thread safety #5

Open
seancarroll opened this issue Mar 13, 2016 · 1 comment
Open

SimpleDateFormat thread safety #5

seancarroll opened this issue Mar 13, 2016 · 1 comment
Assignees

Comments

@seancarroll
Copy link

PropertiesManager.java uses a private static SimpleDateFormat which is not thread safe. From the javadocs (http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html)

Synchronization
Date formats are not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently, it must be synchronized externally.

I can submit a PR just wondering what your preferred solution is

  • Using instance variables
  • Synchonization
  • ThreadLocal
@rladines
Copy link
Collaborator

@seancarroll I see that the today and yesterday methods of PropertiesManager that use the SimpleDateFormat static are not being called anywhere at the moment. That does not mean we should not fix it though. Feel free to submit a pull request.

I think we can just go with the simpler option which is to use instance variables.

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

2 participants