Re: Formatting a date

Endre Stølsvik <[email protected]> Thu, 30 Mar 2006 13:51:48 +0200 (CEST)
Newsgroups gmane.comp.java.webmacro.user
Message-ID <[email protected]>
...

| Is (Simple)DateFormat itself completely thread-safe, by contract?

Forgot to point out that you obvioulsy may just do both the map-lookup 
_and_ the formatting within the one synch-block (but then you can forget 
the benefit of ConcurrentHashMap) - or you could have a pool of each 
format - say 10 instances - and actually do "connection pooling" logic.
  But at that point, I do hope that more than me thinks that having "one 
more cached resource" (with the synch and potential contention hit (now 
both for the synch and the formatting-time), and "memory bloat") for that 
amazingly little benefit (e.g. 1 ms for 40 formattings) isn't worth the 
hassle?

Add a method to dateTool that actually gives you a DateFormat back, and 
javadoc both methods where the users are told to use the 
DateFormat-returning one if they're about to format multiple dates in one 
rendering.

Regards,
Endre.


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642