public boolean aquireGlobalLock(boolean exclusive, long timeout) {
boolean success = true;
for (int i = 0; i < sharedLocks.length; i++) {
Lock toAcquire = exclusive ? sharedLocks[i].writeLock() : sharedLocks[i].readLock();
try {
success = toAcquire.tryLock(timeout, TimeUnit.MILLISECONDS);
if (!success) {
if (log.isTraceEnabled())
log.trace("Could not aquire lock on " + toAcquire + ". Exclusive?" + exclusive);
break;
}