>Ok. I guess VMs have improved and now the "conventional wisdom" has >changed. It used to be that synchronization by itself was a performance >hit, regardless of how it effected other threads. It had something to do >with how it was implemented in the VM. But this information is at least a >couple of years old.
Doing this: for ( ... ) { synchronized { blah } } is considerably slower than this: synchronized { for ( ... ) { blah } } Similarly, if you're going to be calling a synchronized method inside an inner loop, you will save a lot of time by acquiring the lock outside the loop. Then the synchronization overhead is shortcircuited because the JVM sees that we already have the lock and just moves on. -- Brian Goetz Quiotix Corporation [EMAIL PROTECTED] Tel: 650-843-1300 Fax: 650-324-8032 http://www.quiotix.com