changeset 5943:77d4b570dee2

6963841: java/util/concurrent/Phaser/Basic.java fails intermittently Reviewed-by: dl, dholmes
author chegar
date Wed, 04 Apr 2012 15:14:00 +0100
parents 91b635126bf9
children ce745b7a002a
files test/java/util/concurrent/Phaser/Basic.java
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/util/concurrent/Phaser/Basic.java	Fri Sep 07 14:00:31 2012 +0100
+++ b/test/java/util/concurrent/Phaser/Basic.java	Wed Apr 04 15:14:00 2012 +0100
@@ -96,7 +96,7 @@
             int phase = atTheStartingGate.getPhase();
             equal(phase, atTheStartingGate.arrive());
             int awaitPhase = atTheStartingGate.awaitAdvanceInterruptibly
-                (phase, 10, SECONDS);
+                (phase, 30, SECONDS);
             if (expectNextPhase) check(awaitPhase == (phase + 1));
 
             pass();
@@ -188,7 +188,7 @@
                     case 2: case 6: case 7:
                         return awaiter(phaser, -1, SECONDS);
                     default:
-                        return awaiter(phaser, 10, SECONDS); }}
+                        return awaiter(phaser, 30, SECONDS); }}
             public void remove() {throw new UnsupportedOperationException();}};
     }
 
@@ -204,7 +204,7 @@
                     case 2: case 5:
                         return awaiter(phaser, -1, SECONDS);
                     default:
-                        return awaiter(phaser, 10, SECONDS); }}
+                        return awaiter(phaser, 30, SECONDS); }}
             public void remove() {throw new UnsupportedOperationException();}};
     }
 
@@ -251,9 +251,11 @@
             int phase = phaser.getPhase();
             for (int i = 0; i < 4; i++) {
                 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();
                 toTheStartingGate();
+                // allow a1 to block in awaitAdvanceInterruptibly
+                Thread.sleep(2000);
                 a1.interrupt();
                 a1.join();
                 phaser.arriveAndAwaitAdvance();