Search in sources :

Example 1 with LockType

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);
}
Also used : LockType(org.neo4j.lock.LockType) ActiveLock(org.neo4j.lock.ActiveLock)

Aggregations

ActiveLock (org.neo4j.lock.ActiveLock)1 LockType (org.neo4j.lock.LockType)1