if (log.isTraceEnabled()) log.trace("RL acquired for '" + key + "'");
}
}
public boolean acquireLock(String key, boolean exclusive, long millis) {
ReentrantReadWriteLock lock = getLock(key);
try {
if (exclusive) {
return lock.writeLock().tryLock(millis, TimeUnit.MILLISECONDS);
} else {
return lock.readLock().tryLock(millis, TimeUnit.MILLISECONDS);
}
} catch (InterruptedException e) {
log.warn("Thread insterrupted while trying to acquire lock", e);
return false;
}