113 |
|
|
114 |
|
|
115 |
|
/* |
116 |
< |
* getLockQueueLength reports number of waiting threads |
116 |
> |
* getQueueLength reports number of waiting threads |
117 |
|
*/ |
118 |
< |
public void testGetLockQueueLength() { |
118 |
> |
public void testGetQueueLength() { |
119 |
|
final ReentrantLock lock = new ReentrantLock(); |
120 |
|
Thread t1 = new Thread(new InterruptedLockRunnable(lock)); |
121 |
|
Thread t2 = new Thread(new InterruptibleLockRunnable(lock)); |
122 |
|
try { |
123 |
< |
assertEquals(0, lock.getLockQueueLength()); |
123 |
> |
assertEquals(0, lock.getQueueLength()); |
124 |
|
lock.lock(); |
125 |
|
t1.start(); |
126 |
|
Thread.sleep(SHORT_DELAY_MS); |
127 |
< |
assertEquals(1, lock.getLockQueueLength()); |
127 |
> |
assertEquals(1, lock.getQueueLength()); |
128 |
|
t2.start(); |
129 |
|
Thread.sleep(SHORT_DELAY_MS); |
130 |
< |
assertEquals(2, lock.getLockQueueLength()); |
130 |
> |
assertEquals(2, lock.getQueueLength()); |
131 |
|
t1.interrupt(); |
132 |
|
Thread.sleep(SHORT_DELAY_MS); |
133 |
< |
assertEquals(1, lock.getLockQueueLength()); |
133 |
> |
assertEquals(1, lock.getQueueLength()); |
134 |
|
lock.unlock(); |
135 |
|
Thread.sleep(SHORT_DELAY_MS); |
136 |
< |
assertEquals(0, lock.getLockQueueLength()); |
136 |
> |
assertEquals(0, lock.getQueueLength()); |
137 |
|
t1.join(); |
138 |
|
t2.join(); |
139 |
|
} catch(Exception e){ |