Example usage for com.google.common.util.concurrent Monitor tryEnter

List of usage examples for com.google.common.util.concurrent Monitor tryEnter

Introduction

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

Prototype

public boolean tryEnter() 

Source Link

Document

Enters this monitor if it is possible to do so immediately.

Usage

From source file:org.apache.marmotta.commons.locking.ObjectLocks.java

public boolean tryLock(Object name) {
    Monitor lock;
    synchronized (stringLocks) {
        lock = stringLocks.getUnchecked(name);
    }/*from w  w w.ja v  a  2s .  c om*/
    return lock.tryEnter();
}

From source file:clocker.docker.location.strategy.basic.GroupPlacementStrategy.java

@Override
public boolean tryAcquireMutex(String mutexId, String description) {
    LOG.debug("Try to enter monitor {}: {}", mutexId, description);
    Monitor monitor = createMonitor(mutexId);
    return monitor.tryEnter();
}