_numActive is an int so the synchronized block wasn't needed.
But the extra "synchronized" is in the case where a new object has to be created and not in the critical "get from pool" code path.


All the success code paths have now one synchronized block.
I'll leave it as is for now.

Dirk


David Graham wrote:


--- Dirk Verbeeck <[EMAIL PROTECTED]> wrote:


The pool manipulation was synchronized, only the isEmpty() test is not.
I didn't realize that _numActive++ should be synchronized, I thought the

++ operator was atomic.



The datatype the operator is applied to is what matters. Assignments to
ints are atomic, assignments to longs aren't because they are 64 bits. So, if _numActive is an int, I don't think it needs to be synchronized.


David






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



Reply via email to