On Tue, 10 Aug 2004 20:10:46 -0700, Martin Cooper <[EMAIL PROTECTED]> wrote:
> On Tue, 10 Aug 2004 17:27:30 -0400, Gary Gregory
> <[EMAIL PROTECTED]> 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.
> 

You might want to review how ThreadLocal variables are implemented,
though ... it's most likely to be some sort of HashMap keyed by
classloader, and the get/put operations to update your thread's local
copy are likely to be synchronized internally.

The best way to avoid synchronization is likely to create one in a
local variable, then pass it around to whomever needs it.  Ugly, but
performance hacks are sometimes like that.

> --
> Martin Cooper

Craig

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

Reply via email to