Example usage for com.google.common.util.concurrent Striped lock

List of usage examples for com.google.common.util.concurrent Striped lock

Introduction

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

Prototype

public static Striped<Lock> lock(int stripes) 

Source Link

Document

Creates a Striped with eagerly initialized, strongly referenced locks.

Usage

From source file:com.palantir.atlasdb.transaction.service.ConcurrentMapWithLogging.java

private ConcurrentMapWithLogging(WriteAheadLog log) {
    this.log = log;
    map = new ConcurrentHashMap<Long, Long>();
    stripedLock = Striped.lock(LOCK_STRIPES_NUMBER);
}

From source file:pgentity.pool.EntityPool.java

private SingleloadCache<EntityIdentifier, PooledEntity> buildInnerCache() {
    Cache<EntityIdentifier, PooledEntity> rootCache = CacheBuilder.newBuilder()
            .expireAfterWrite(2, TimeUnit.SECONDS).maximumSize(5000).build();

    return new SingleloadCache(rootCache, PooledEntityLoader.inst(), this.lockManager, Striped.lock(64));
}

From source file:pgentity.pool.EntityPool.java

private Striped<Lock> buildLocks() {
    return Striped.lock(256);
}

From source file:org.dcache.nfs.v4.nlm.SimpleLm.java

public SimpleLm(int concurrency) {
    objLock = Striped.lock(concurrency);
}

From source file:com.palantir.atlasdb.transaction.service.TransactionServiceImpl.java

private TransactionServiceImpl(Supplier<ConcurrentMapWithLogging> mapSupplier,
        ConcurrentMapWithLogging currentMap, TransactionKVSWrapper kvsWrapper,
        MetadataStorageService metadataStorageService) {
    this.mapSupplier = mapSupplier;
    this.currentMapSwapper = new LockableReference<ConcurrentMapWithLogging>(currentMap);
    this.mapBeingFlushed = null;
    this.kvsWrapper = kvsWrapper;
    this.stripedLock = Striped.lock(LOCK_STRIPES_NUMBER);
    this.flushLock = new ReentrantLock();
    this.metadataStorageService = metadataStorageService;
    this.executor = null;
    this.running = false;
}

From source file:guru.qas.martini.jmeter.controller.MartiniFilterController.java

@Override
protected void completeSetup() {
    index = new ConcurrentHashMap<>();
    striped = Striped.lock(10);

    Collection<Martini> martinis = getMartinis();
    checkState(!isNoMartiniFoundFatal() || !martinis.isEmpty(), Messages.getMessage(NO_MARTINI_FOUND));

    completeSetup(martinis);/*from w w w .  j a  v  a 2s.com*/
    if (martinis.isEmpty()) {
        super.setDone(true);
    }
}