提交 89b129d8 编写于 作者: C chegar

6963841: java/util/concurrent/Phaser/Basic.java fails intermittently

Reviewed-by: dl, dholmes
上级 0230a043
...@@ -96,7 +96,7 @@ public class Basic { ...@@ -96,7 +96,7 @@ public class Basic {
int phase = atTheStartingGate.getPhase(); int phase = atTheStartingGate.getPhase();
equal(phase, atTheStartingGate.arrive()); equal(phase, atTheStartingGate.arrive());
int awaitPhase = atTheStartingGate.awaitAdvanceInterruptibly int awaitPhase = atTheStartingGate.awaitAdvanceInterruptibly
(phase, 10, SECONDS); (phase, 30, SECONDS);
if (expectNextPhase) check(awaitPhase == (phase + 1)); if (expectNextPhase) check(awaitPhase == (phase + 1));
pass(); pass();
...@@ -188,7 +188,7 @@ public class Basic { ...@@ -188,7 +188,7 @@ public class Basic {
case 2: case 6: case 7: case 2: case 6: case 7:
return awaiter(phaser, -1, SECONDS); return awaiter(phaser, -1, SECONDS);
default: default:
return awaiter(phaser, 10, SECONDS); }} return awaiter(phaser, 30, SECONDS); }}
public void remove() {throw new UnsupportedOperationException();}}; public void remove() {throw new UnsupportedOperationException();}};
} }
...@@ -204,7 +204,7 @@ public class Basic { ...@@ -204,7 +204,7 @@ public class Basic {
case 2: case 5: case 2: case 5:
return awaiter(phaser, -1, SECONDS); return awaiter(phaser, -1, SECONDS);
default: default:
return awaiter(phaser, 10, SECONDS); }} return awaiter(phaser, 30, SECONDS); }}
public void remove() {throw new UnsupportedOperationException();}}; public void remove() {throw new UnsupportedOperationException();}};
} }
...@@ -251,9 +251,11 @@ public class Basic { ...@@ -251,9 +251,11 @@ public class Basic {
int phase = phaser.getPhase(); int phase = phaser.getPhase();
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
check(phaser.getPhase() == phase); check(phaser.getPhase() == phase);
Awaiter a1 = awaiter(phaser, 10, SECONDS); a1.start(); Awaiter a1 = awaiter(phaser, 30, SECONDS); a1.start();
Arriver a2 = arrivers.next(); a2.start(); Arriver a2 = arrivers.next(); a2.start();
toTheStartingGate(); toTheStartingGate();
// allow a1 to block in awaitAdvanceInterruptibly
Thread.sleep(2000);
a1.interrupt(); a1.interrupt();
a1.join(); a1.join();
phaser.arriveAndAwaitAdvance(); phaser.arriveAndAwaitAdvance();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册