169 |
|
}}); |
170 |
|
|
171 |
|
t.start(); |
172 |
< |
Thread.sleep(SHORT_DELAY_MS); |
172 |
> |
delay(SHORT_DELAY_MS); |
173 |
|
s.release(); |
174 |
|
s.release(); |
175 |
|
s.acquire(); |
193 |
|
}}); |
194 |
|
|
195 |
|
t.start(); |
196 |
< |
Thread.sleep(SHORT_DELAY_MS); |
196 |
> |
delay(SHORT_DELAY_MS); |
197 |
|
s.release(); |
198 |
|
s.release(); |
199 |
|
s.acquireUninterruptibly(); |
238 |
|
}}); |
239 |
|
|
240 |
|
t.start(); |
241 |
< |
Thread.sleep(SHORT_DELAY_MS); |
241 |
> |
delay(SHORT_DELAY_MS); |
242 |
|
t.interrupt(); |
243 |
|
t.join(); |
244 |
|
} |
255 |
|
}}); |
256 |
|
|
257 |
|
t.start(); |
258 |
< |
Thread.sleep(SHORT_DELAY_MS); |
258 |
> |
delay(SHORT_DELAY_MS); |
259 |
|
t.interrupt(); |
260 |
|
t.join(); |
261 |
|
} |
270 |
|
assertFalse(lock.hasQueuedThreads()); |
271 |
|
lock.acquireUninterruptibly(); |
272 |
|
t1.start(); |
273 |
< |
Thread.sleep(SHORT_DELAY_MS); |
273 |
> |
delay(SHORT_DELAY_MS); |
274 |
|
assertTrue(lock.hasQueuedThreads()); |
275 |
|
t2.start(); |
276 |
< |
Thread.sleep(SHORT_DELAY_MS); |
276 |
> |
delay(SHORT_DELAY_MS); |
277 |
|
assertTrue(lock.hasQueuedThreads()); |
278 |
|
t1.interrupt(); |
279 |
< |
Thread.sleep(SHORT_DELAY_MS); |
279 |
> |
delay(SHORT_DELAY_MS); |
280 |
|
assertTrue(lock.hasQueuedThreads()); |
281 |
|
lock.release(); |
282 |
< |
Thread.sleep(SHORT_DELAY_MS); |
282 |
> |
delay(SHORT_DELAY_MS); |
283 |
|
assertFalse(lock.hasQueuedThreads()); |
284 |
|
t1.join(); |
285 |
|
t2.join(); |
295 |
|
assertEquals(0, lock.getQueueLength()); |
296 |
|
lock.acquireUninterruptibly(); |
297 |
|
t1.start(); |
298 |
< |
Thread.sleep(SHORT_DELAY_MS); |
298 |
> |
delay(SHORT_DELAY_MS); |
299 |
|
assertEquals(1, lock.getQueueLength()); |
300 |
|
t2.start(); |
301 |
< |
Thread.sleep(SHORT_DELAY_MS); |
301 |
> |
delay(SHORT_DELAY_MS); |
302 |
|
assertEquals(2, lock.getQueueLength()); |
303 |
|
t1.interrupt(); |
304 |
< |
Thread.sleep(SHORT_DELAY_MS); |
304 |
> |
delay(SHORT_DELAY_MS); |
305 |
|
assertEquals(1, lock.getQueueLength()); |
306 |
|
lock.release(); |
307 |
< |
Thread.sleep(SHORT_DELAY_MS); |
307 |
> |
delay(SHORT_DELAY_MS); |
308 |
|
assertEquals(0, lock.getQueueLength()); |
309 |
|
t1.join(); |
310 |
|
t2.join(); |
321 |
|
lock.acquireUninterruptibly(); |
322 |
|
assertTrue(lock.getQueuedThreads().isEmpty()); |
323 |
|
t1.start(); |
324 |
< |
Thread.sleep(SHORT_DELAY_MS); |
324 |
> |
delay(SHORT_DELAY_MS); |
325 |
|
assertTrue(lock.getQueuedThreads().contains(t1)); |
326 |
|
t2.start(); |
327 |
< |
Thread.sleep(SHORT_DELAY_MS); |
327 |
> |
delay(SHORT_DELAY_MS); |
328 |
|
assertTrue(lock.getQueuedThreads().contains(t1)); |
329 |
|
assertTrue(lock.getQueuedThreads().contains(t2)); |
330 |
|
t1.interrupt(); |
331 |
< |
Thread.sleep(SHORT_DELAY_MS); |
331 |
> |
delay(SHORT_DELAY_MS); |
332 |
|
assertFalse(lock.getQueuedThreads().contains(t1)); |
333 |
|
assertTrue(lock.getQueuedThreads().contains(t2)); |
334 |
|
lock.release(); |
335 |
< |
Thread.sleep(SHORT_DELAY_MS); |
335 |
> |
delay(SHORT_DELAY_MS); |
336 |
|
assertTrue(lock.getQueuedThreads().isEmpty()); |
337 |
|
t1.join(); |
338 |
|
t2.join(); |
531 |
|
}}); |
532 |
|
|
533 |
|
t.start(); |
534 |
< |
Thread.sleep(SHORT_DELAY_MS); |
534 |
> |
delay(SHORT_DELAY_MS); |
535 |
|
s.release(); |
536 |
|
s.release(); |
537 |
|
s.release(); |
556 |
|
}}); |
557 |
|
|
558 |
|
t.start(); |
559 |
< |
Thread.sleep(SHORT_DELAY_MS); |
559 |
> |
delay(SHORT_DELAY_MS); |
560 |
|
s.release(2); |
561 |
|
s.acquire(2); |
562 |
|
s.release(1); |
577 |
|
}}); |
578 |
|
|
579 |
|
t.start(); |
580 |
< |
Thread.sleep(SHORT_DELAY_MS); |
580 |
> |
delay(SHORT_DELAY_MS); |
581 |
|
s.release(6); |
582 |
|
s.acquire(2); |
583 |
|
s.acquire(2); |
644 |
|
}}); |
645 |
|
|
646 |
|
t.start(); |
647 |
< |
Thread.sleep(SHORT_DELAY_MS); |
647 |
> |
delay(SHORT_DELAY_MS); |
648 |
|
t.interrupt(); |
649 |
|
t.join(); |
650 |
|
} |
661 |
|
}}); |
662 |
|
|
663 |
|
t.start(); |
664 |
< |
Thread.sleep(SHORT_DELAY_MS); |
664 |
> |
delay(SHORT_DELAY_MS); |
665 |
|
t.interrupt(); |
666 |
|
t.join(); |
667 |
|
} |
678 |
|
}}); |
679 |
|
|
680 |
|
t.start(); |
681 |
< |
Thread.sleep(SHORT_DELAY_MS); |
681 |
> |
delay(SHORT_DELAY_MS); |
682 |
|
t.interrupt(); |
683 |
|
t.join(); |
684 |
|
} |
695 |
|
}}); |
696 |
|
|
697 |
|
t.start(); |
698 |
< |
Thread.sleep(SHORT_DELAY_MS); |
698 |
> |
delay(SHORT_DELAY_MS); |
699 |
|
t.interrupt(); |
700 |
|
t.join(); |
701 |
|
} |
710 |
|
assertEquals(0, lock.getQueueLength()); |
711 |
|
lock.acquireUninterruptibly(); |
712 |
|
t1.start(); |
713 |
< |
Thread.sleep(SHORT_DELAY_MS); |
713 |
> |
delay(SHORT_DELAY_MS); |
714 |
|
assertEquals(1, lock.getQueueLength()); |
715 |
|
t2.start(); |
716 |
< |
Thread.sleep(SHORT_DELAY_MS); |
716 |
> |
delay(SHORT_DELAY_MS); |
717 |
|
assertEquals(2, lock.getQueueLength()); |
718 |
|
t1.interrupt(); |
719 |
< |
Thread.sleep(SHORT_DELAY_MS); |
719 |
> |
delay(SHORT_DELAY_MS); |
720 |
|
assertEquals(1, lock.getQueueLength()); |
721 |
|
lock.release(); |
722 |
< |
Thread.sleep(SHORT_DELAY_MS); |
722 |
> |
delay(SHORT_DELAY_MS); |
723 |
|
assertEquals(0, lock.getQueueLength()); |
724 |
|
t1.join(); |
725 |
|
t2.join(); |