You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Edgar Poce <ed...@gmail.com> on 2007/09/14 16:15:52 UTC
DateFormat is not thread safe
Hi,
I've just downloaded the Sling code and I found that the class
org.apache.sling.obr.Repository instantiates DateFormat
implementations statically and uses them in instance methods which are
not synchronized. I'm not familiarized with the code, I'm not sure
whether the access to those methods is synchronized somewhere else,
but if they are not the the DateFormat will generate wrong string
representations of the date under heavy load.
see http://java.sun.com/j2se/1.4.2/docs/api/java/text/DateFormat.html
br,
edgar
Re: DateFormat is not thread safe
Posted by Felix Meschberger <Fe...@day.com>.
Hi Edgar,
Thanks for the hint. I just fixed it by synchronizing on the respective
DateFormat instance.
Regards
Felix
Am Freitag, den 14.09.2007, 11:15 -0300 schrieb Edgar Poce:
> Hi,
>
> I've just downloaded the Sling code and I found that the class
> org.apache.sling.obr.Repository instantiates DateFormat
> implementations statically and uses them in instance methods which are
> not synchronized. I'm not familiarized with the code, I'm not sure
> whether the access to those methods is synchronized somewhere else,
> but if they are not the the DateFormat will generate wrong string
> representations of the date under heavy load.
>
> see http://java.sun.com/j2se/1.4.2/docs/api/java/text/DateFormat.html
>
> br,
> edgar