Java Code Examples for java.util.concurrent.locks.ReentrantReadWriteLock#hasWaiters()

The following examples show how to use java.util.concurrent.locks.ReentrantReadWriteLock#hasWaiters() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReentrantReadWriteLockTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void testHasWaitersNPE(boolean fair) {
    final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(fair);
    try {
        lock.hasWaiters(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 2
Source File: ReentrantReadWriteLockTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void testHasWaitersIAE(boolean fair) {
    final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(fair);
    final Condition c = lock.writeLock().newCondition();
    final ReentrantReadWriteLock lock2 = new ReentrantReadWriteLock(fair);
    try {
        lock2.hasWaiters(c);
        shouldThrow();
    } catch (IllegalArgumentException success) {}
}
 
Example 3
Source File: ReentrantReadWriteLockTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void testHasWaitersIMSE(boolean fair) {
    final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(fair);
    final Condition c = lock.writeLock().newCondition();
    try {
        lock.hasWaiters(c);
        shouldThrow();
    } catch (IllegalMonitorStateException success) {}
}
 
Example 4
Source File: ReentrantReadWriteLockTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void testHasWaitersNPE(boolean fair) {
    final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(fair);
    try {
        lock.hasWaiters(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 5
Source File: ReentrantReadWriteLockTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void testHasWaitersIAE(boolean fair) {
    final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(fair);
    final Condition c = lock.writeLock().newCondition();
    final ReentrantReadWriteLock lock2 = new ReentrantReadWriteLock(fair);
    try {
        lock2.hasWaiters(c);
        shouldThrow();
    } catch (IllegalArgumentException success) {}
}
 
Example 6
Source File: ReentrantReadWriteLockTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void testHasWaitersIMSE(boolean fair) {
    final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(fair);
    final Condition c = lock.writeLock().newCondition();
    try {
        lock.hasWaiters(c);
        shouldThrow();
    } catch (IllegalMonitorStateException success) {}
}