jdk/test/java/util/concurrent/Executors/AutoShutdown.java
changeset 10119 277fd8d9fcda
parent 9035 1255eb81cc2f
child 32991 b27c76b82713
equal deleted inserted replaced
10118:c22b087661be 10119:277fd8d9fcda
    65         phaser.arriveAndAwaitAdvance();
    65         phaser.arriveAndAwaitAdvance();
    66         equal(Thread.activeCount(), count0 + 2);
    66         equal(Thread.activeCount(), count0 + 2);
    67         e1 = e2 = null;
    67         e1 = e2 = null;
    68         for (int i = 0; i < 10 && Thread.activeCount() > count0; i++)
    68         for (int i = 0; i < 10 && Thread.activeCount() > count0; i++)
    69             tryWaitForFinalizersToRun();
    69             tryWaitForFinalizersToRun();
       
    70         for (int i = 0; i < 10; ++i) { // give JVM a chance to settle.
       
    71             if (Thread.activeCount() == count0)
       
    72                 return;
       
    73             Thread.sleep(1000);
       
    74         }
    70         equal(Thread.activeCount(), count0);
    75         equal(Thread.activeCount(), count0);
    71     }
    76     }
    72 
    77 
    73     //--------------------- Infrastructure ---------------------------
    78     //--------------------- Infrastructure ---------------------------
    74     static volatile int passed = 0, failed = 0;
    79     static volatile int passed = 0, failed = 0;