commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <>
Subject [pool] excessive synch scope when checking for allocated latches?
Date Wed, 13 Jan 2010 12:50:29 GMT
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()) {
    } else {

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)?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message