Example usage for com.google.common.util.concurrent CycleDetectingLockFactory newReentrantLock

List of usage examples for com.google.common.util.concurrent CycleDetectingLockFactory newReentrantLock

Introduction

In this page you can find the example usage for com.google.common.util.concurrent CycleDetectingLockFactory newReentrantLock.

Prototype

public ReentrantLock newReentrantLock(String lockName) 

Source Link

Document

Equivalent to newReentrantLock(lockName, false) .

Usage

From source file:io.tilt.minka.business.impl.SemaphoreImpl.java

public SemaphoreImpl(final Config config, final SpectatorSupplier supplier, final ShardID shardId) {
    this.config = config;
    this.rules = new HashMap<>();
    getLockingRules().forEach(rule -> this.rules.put(rule.getAction(), rule));
    this.supplier = supplier;
    locksByAction = new HashMap<>();
    final CycleDetectingLockFactory lockFactory = CycleDetectingLockFactory.newInstance(Policies.DISABLED);
    for (Action key : Action.values()) {
        ReentrantLock lock = lockFactory.newReentrantLock(key.toString());
        logger.debug("{}: ({}) Creating lock: {} for Action: {}", getClass().getSimpleName(), shardId,
                lock.getClass().getSimpleName(), key);
        locksByAction.put(key, lock);//  www.  j a va  2 s . com
        //locksByAction.put(key, new ReentrantLock());
    }
}