Concerning class scoped DateFormat instances :
- If you have clarified that NO Thread pools are used in your environment then only new Thread instances concurrently access your DateFormat instance. In this case it is recommended to synchronize that DateFormat instance externally
- In case Thread pools are used, there is a limited number of Thread instances that can access your DateFormat instance concurrently. Thus it is recommended to create separate DateFormat instances for each thread using the ThreadLocal approach
Read full article from Java Best Practices – DateFormat in a Multithreading Environment | Java Code Geeks
No comments:
Post a Comment