You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Phil Steitz <ph...@gmail.com> on 2010/01/13 13:50:29 UTC
[pool] excessive synch scope when checking for allocated latches?
GOP and GKOP both use the following idiom in several places to check
to see if an instance has been allocated to a thread:
synchronized (this) {
// Make sure allocate hasn't already assigned an object
// in a different thread or permitted a new object to be created
if (latch.getPair() == null && !latch.mayCreate()) {
_allocationQueue.remove(latch);
} else {
break;
}
}
Couldn't the check on latch state be synched just on the latch (and
then acquire the pool lock only if there is something to remove)?
Phil
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org