You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Martin Cooper <mf...@gmail.com> on 2004/08/10 21:34:34 UTC
[lang] FastNumberFormat?
Is there a fast version of java.text.NumberFormat hiding somewhere in
Commons Lang that I haven't been able to find? The JDK version of
format() actually does synchronisation, and I'm calling it enough that
this hurts.
TIA.
--
Martin Cooper
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [lang] FastNumberFormat?
Posted by Martin Cooper <mf...@gmail.com>.
On Tue, 10 Aug 2004 22:23:11 +0200, Andreas Schildbach
<an...@schildbach.de> wrote:
>
>
> Martin Cooper wrote:
>
> > Is there a fast version of java.text.NumberFormat hiding somewhere in
> > Commons Lang that I haven't been able to find? The JDK version of
> > format() actually does synchronisation, and I'm calling it enough that
> > this hurts.
>
> Are you sure that it synchronizes?
>
> From the NumberFormat JavaDoc:
>
> "Number formats are generally 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."
I misspoke slightly - it's DecimalFormat that synchronises, not
NumberFormat. And yes, I'm sure, despite the JavaDoc for DecimalFormat
saying the exact same thing. I looked at the source code, and it's
synchronising on a buffer. Yuk!
--
Martin Cooper
>
> Regards,
>
> Andreas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [lang] FastNumberFormat?
Posted by Andreas Schildbach <an...@schildbach.de>.
Martin Cooper wrote:
> Is there a fast version of java.text.NumberFormat hiding somewhere in
> Commons Lang that I haven't been able to find? The JDK version of
> format() actually does synchronisation, and I'm calling it enough that
> this hurts.
Are you sure that it synchronizes?
From the NumberFormat JavaDoc:
"Number formats are generally 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."
Regards,
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org