SimpleDateFormat and Thread safety
I have a question with regards to SimpleDateFormat and it's lack of thread safety.
I have a DateUtils class which does a series of date related operations, one among them being parsing wherein this static method takes in a string and parses it to a Date. I have a couple of SimpleDateFormats and this method spins thru' those and returns back a Date as soon as a matching format is found. The problem I'm encountering is that these SimpleDateFormats are being stored in an array that is static (since the method is static - as it is within an util class, had to declare this array as static as well). With this configuration, isn't it true that this poses a threat when multiple threads are running simultaneously? If so, should I use ThreadLocal to make it thread safe? Or, can I somehow remove the "static" declaration and make it work?
Thanks in advance.