Java Code Examples for java.util.concurrent.locks.ReentrantLock#getWaitQueueLength()

The following examples show how to use java.util.concurrent.locks.ReentrantLock#getWaitQueueLength() . 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: ReentrantLockTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void testGetWaitQueueLengthNPE(boolean fair) {
    final ReentrantLock lock = new ReentrantLock(fair);
    try {
        lock.getWaitQueueLength(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 2
Source File: ReentrantLockTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void testGetWaitQueueLengthIAE(boolean fair) {
    final ReentrantLock lock = new ReentrantLock(fair);
    final Condition c = lock.newCondition();
    final ReentrantLock lock2 = new ReentrantLock(fair);
    try {
        lock2.getWaitQueueLength(c);
        shouldThrow();
    } catch (IllegalArgumentException success) {}
}
 
Example 3
Source File: ReentrantLockTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void testGetWaitQueueLengthIMSE(boolean fair) {
    final ReentrantLock lock = new ReentrantLock(fair);
    final Condition c = lock.newCondition();
    try {
        lock.getWaitQueueLength(c);
        shouldThrow();
    } catch (IllegalMonitorStateException success) {}
}
 
Example 4
Source File: ReentrantLockTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void testGetWaitQueueLengthNPE(boolean fair) {
    final ReentrantLock lock = new ReentrantLock(fair);
    try {
        lock.getWaitQueueLength(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 5
Source File: ReentrantLockTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void testGetWaitQueueLengthIAE(boolean fair) {
    final ReentrantLock lock = new ReentrantLock(fair);
    final Condition c = lock.newCondition();
    final ReentrantLock lock2 = new ReentrantLock(fair);
    try {
        lock2.getWaitQueueLength(c);
        shouldThrow();
    } catch (IllegalArgumentException success) {}
}
 
Example 6
Source File: ReentrantLockTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void testGetWaitQueueLengthIMSE(boolean fair) {
    final ReentrantLock lock = new ReentrantLock(fair);
    final Condition c = lock.newCondition();
    try {
        lock.getWaitQueueLength(c);
        shouldThrow();
    } catch (IllegalMonitorStateException success) {}
}