下面列出了java.util.concurrent.locks.ReentrantLock#getWaitQueueLength() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void testGetWaitQueueLengthNPE(boolean fair) {
final ReentrantLock lock = new ReentrantLock(fair);
try {
lock.getWaitQueueLength(null);
shouldThrow();
} catch (NullPointerException success) {}
}
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) {}
}
public void testGetWaitQueueLengthIMSE(boolean fair) {
final ReentrantLock lock = new ReentrantLock(fair);
final Condition c = lock.newCondition();
try {
lock.getWaitQueueLength(c);
shouldThrow();
} catch (IllegalMonitorStateException success) {}
}
public void testGetWaitQueueLengthNPE(boolean fair) {
final ReentrantLock lock = new ReentrantLock(fair);
try {
lock.getWaitQueueLength(null);
shouldThrow();
} catch (NullPointerException success) {}
}
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) {}
}
public void testGetWaitQueueLengthIMSE(boolean fair) {
final ReentrantLock lock = new ReentrantLock(fair);
final Condition c = lock.newCondition();
try {
lock.getWaitQueueLength(c);
shouldThrow();
} catch (IllegalMonitorStateException success) {}
}