On Sat, 25 Nov 2006 11:37:38 +0000, Rory Winston wrote:

> Regarding "The real fix here would be to make this and other boolean ivars
> volatile and the get/set methods unsynchronized" - performance wise, would
> this not amount to the same thing - doesnt a volatile var (at least in JDK
> 5+) force a memory barrier (sync) on a read or write?

Yes (that's the point :) but it does not cause the thread to stall & be
rescheduled just for reading a frickin' boolean that is pretty much the
same all the time. Simply a bit less granular locking can bring pool a
long way, because 99% of the time it is probably neither completely empty
nor completely full - and those are the cases where borrow and return can
happily run in parallel for large parts.

cheers
Holger



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

Reply via email to