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

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

Introduction

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

Prototype

public boolean isWriteLocked() 

Source Link

Document

Queries if the write lock is held by any thread.

Usage

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

public static void assertWriteLocked(ReentrantReadWriteLock lock) {
    if (!lock.isWriteLocked()) {
        throw new AssertionError("Call this operation from inside withWriteLocked().");
    }/*from w w  w  .  ja  v a2s.co m*/
}

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();
}