use of org.neo4j.lock.LockType in project neo4j by neo4j.
the class ForsetiClient method holdsLock.
@Override
public boolean holdsLock(long id, ResourceType resource, LockType lockType) {
ConcurrentMap<Long, ForsetiLockManager.Lock> lockMap = lockMaps[resource.typeId()];
ForsetiLockManager.Lock lock = lockMap.get(id);
if (lock == null) {
return false;
}
// If we are looking for shared a lock and have the exclusive its fine because exclusive is more strict
// Check type atomically
LockType type = lock.type();
return lock.isOwnedBy(this) && (type == lockType || type == EXCLUSIVE);
}
Aggregations