commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mfncoo...@gmail.com>
Subject Re: [lang] FastNumberFormat?
Date Wed, 11 Aug 2004 03:10:46 GMT
On Tue, 10 Aug 2004 17:27:30 -0400, Gary Gregory
<ggregory@seagullsoftware.com> wrote:
> Why not give each thread its own DecimalFormat instance in a thread
> local variable? Then you do not have to worry about it.

That's most likely what I'll end up doing. I was just hoping to get
rid of synchronisation altogether, including the lock checks.

--
Martin Cooper


> 
> Gary
> 
> 
> 
> > -----Original Message-----
> > From: Martin Cooper [mailto:mfncooper@gmail.com]
> > Sent: Tuesday, August 10, 2004 14:19
> > To: Jakarta Commons Users List
> > Subject: Re: [lang] FastNumberFormat?
> >
> > On Tue, 10 Aug 2004 22:23:11 +0200, Andreas Schildbach
> > <andreas@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
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message