Example usage for java.util.concurrent.locks ReentrantReadWriteLock getReadLockCount

List of usage examples for java.util.concurrent.locks ReentrantReadWriteLock getReadLockCount

Introduction

In this page you can find the example usage for java.util.concurrent.locks ReentrantReadWriteLock getReadLockCount.

Prototype

public int getReadLockCount() 

Source Link

Document

Queries the number of read locks held for this lock.

Usage

From source file:com.aerospike.delivery.db.base.Database.java

public static void assertReadLocked(ReentrantReadWriteLock lock) {
    if (lock.getReadLockCount() == 0) {
        throw new AssertionError("Call this operation from inside withReadLocked().");
    }/*www  .j av a 2s  . com*/
}

From source file:Main.java

private static String getLockInfo(ReentrantReadWriteLock lock) {
    String lockid = "RWLock@" + Integer.toHexString(lock.hashCode());
    return lockid + " readLockCount=" + lock.getReadLockCount() + " isWriteLocked=" + lock.isWriteLocked();
}