commons-lang provides a bunch of very useful classes including:
http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/time/FastDateFormat.html

Scott

--
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au


Sebastian Bazley wrote:


There is a comment in CookieManager.java which says:

// FIXME: SimpleDateFormat isn't thread-safe, so we need to synchronize
// access to it.
private static SimpleDateFormat dateFormat =
new SimpleDateFormat("EEEE, dd-MMM-yy HH:mm:ss zzz")

And from the Javadoc for SimpleDateFormat:

<<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.>>

The bug details show that there has been some work done towards removing this 
restriction, but this has not been completed, as far
as I can tell.

The dateFormat instances could be cached using ThreadLocal(), or maybe it would be 
simpler to synchronize the accesses to
dateFormat?

That should make the errors go away, or have I misunderstood something?

S.






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to