194 |
|
for (int i = 0; i < 10; i++) |
195 |
|
phaser.register(); |
196 |
|
threads.add(newStartedThread(new CheckedRunnable() { |
197 |
< |
void realRun() throws InterruptedException { |
197 |
> |
public void realRun() throws InterruptedException { |
198 |
|
Thread.sleep(SMALL_DELAY_MS); |
199 |
|
phaser.arriveAndDeregister(); |
200 |
|
}})); |
295 |
|
public void testArriveAndDeregister6() throws InterruptedException { |
296 |
|
final Phaser phaser = new Phaser(2); |
297 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
298 |
< |
void realRun() { |
298 |
> |
public void realRun() { |
299 |
|
sleepTillInterrupted(SHORT_DELAY_MS); |
300 |
|
phaser.arrive(); |
301 |
|
}}); |
330 |
|
phaser.register(); |
331 |
|
|
332 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
333 |
< |
void realRun() throws InterruptedException { |
333 |
> |
public void realRun() throws InterruptedException { |
334 |
|
phaser.register(); |
335 |
|
sleepTillInterrupted(LONG_DELAY_MS); |
336 |
|
phaser.awaitAdvance(phaser.arrive()); |
353 |
|
List<Thread> threads = new ArrayList<Thread>(); |
354 |
|
for (int i = 0; i < 4; i++) { |
355 |
|
threads.add(newStartedThread(new CheckedRunnable() { |
356 |
< |
void realRun() { |
356 |
> |
public void realRun() { |
357 |
|
int phase = phaser.arrive(); |
358 |
|
phaseCount.incrementAndGet(); |
359 |
|
sleepTillInterrupted(SMALL_DELAY_MS); |
376 |
|
List<Thread> threads = new ArrayList<Thread>(); |
377 |
|
for (int i = 0; i < 8; i++) { |
378 |
|
threads.add(newStartedThread(new CheckedRunnable() { |
379 |
< |
void realRun() { |
379 |
> |
public void realRun() { |
380 |
|
sleepTillInterrupted(SHORT_DELAY_MS); |
381 |
|
phaser.arrive(); |
382 |
|
}})); |
399 |
|
* waits for the second thread's party to arrive |
400 |
|
*/ |
401 |
|
Thread t1 = newStartedThread(new CheckedRunnable() { |
402 |
< |
void realRun() { |
402 |
> |
public void realRun() { |
403 |
|
sleepTillInterrupted(SMALL_DELAY_MS); |
404 |
|
int phase = phaser.awaitAdvance(phaser.arrive()); |
405 |
|
/* |
414 |
|
* should exit peacefully as this one |
415 |
|
*/ |
416 |
|
Thread t2 = newStartedThread(new CheckedRunnable() { |
417 |
< |
void realRun() { |
417 |
> |
public void realRun() { |
418 |
|
sleepTillInterrupted(MEDIUM_DELAY_MS); |
419 |
|
int p1 = phaser.arrive(); |
420 |
|
int phase = phaser.awaitAdvance(p1); |
446 |
|
public void testArriveAndAwaitAdvance2() throws InterruptedException { |
447 |
|
final Phaser phaser = new Phaser(2); |
448 |
|
Thread th = newStartedThread(new CheckedRunnable() { |
449 |
< |
void realRun() { |
449 |
> |
public void realRun() { |
450 |
|
phaser.arriveAndAwaitAdvance(); |
451 |
|
}}); |
452 |
|
|
469 |
|
final List<Thread> threads = new ArrayList<Thread>(); |
470 |
|
for (int i = 0; i < 6; i++) { |
471 |
|
threads.add(newStartedThread(new CheckedRunnable() { |
472 |
< |
void realRun() throws InterruptedException { |
472 |
> |
public void realRun() throws InterruptedException { |
473 |
|
phaser.register(); |
474 |
|
sleepTillInterrupted(SHORT_DELAY_MS); |
475 |
|
arrivingCount.getAndIncrement(); |