< prev index next >

test/jdk/java/util/concurrent/tck/ForkJoinTask8Test.java

Print this page
8227235: rare failures in testForkHelpQuiesce tck tests
Reviewed-by: martin, alanb


 542             }};
 543         testInvokeOnPool(pool, a);
 544     }
 545 
 546     /**
 547      * helpQuiesce returns when tasks are complete.
 548      * getQueuedTaskCount returns 0 when quiescent
 549      */
 550     public void testForkHelpQuiesce() {
 551         testForkHelpQuiesce(mainPool());
 552     }
 553     public void testForkHelpQuiesce_Singleton() {
 554         testForkHelpQuiesce(singletonPool());
 555     }
 556     public void testForkHelpQuiesce(ForkJoinPool pool) {
 557         RecursiveAction a = new CheckedRecursiveAction() {
 558             protected void realCompute() {
 559                 AsyncFib f = new AsyncFib(8);
 560                 assertSame(f, f.fork());
 561                 helpQuiesce();


 562                 assertEquals(0, getQueuedTaskCount());
 563                 f.checkCompletedNormally();
 564             }};
 565         testInvokeOnPool(pool, a);
 566     }
 567 
 568     /**
 569      * invoke task throws exception when task completes abnormally
 570      */
 571     public void testAbnormalInvoke() {
 572         testAbnormalInvoke(mainPool());
 573     }
 574     public void testAbnormalInvoke_Singleton() {
 575         testAbnormalInvoke(singletonPool());
 576     }
 577     public void testAbnormalInvoke(ForkJoinPool pool) {
 578         RecursiveAction a = new CheckedRecursiveAction() {
 579             protected void realCompute() {
 580                 FailingAsyncFib f = new FailingAsyncFib(8);
 581                 try {




 542             }};
 543         testInvokeOnPool(pool, a);
 544     }
 545 
 546     /**
 547      * helpQuiesce returns when tasks are complete.
 548      * getQueuedTaskCount returns 0 when quiescent
 549      */
 550     public void testForkHelpQuiesce() {
 551         testForkHelpQuiesce(mainPool());
 552     }
 553     public void testForkHelpQuiesce_Singleton() {
 554         testForkHelpQuiesce(singletonPool());
 555     }
 556     public void testForkHelpQuiesce(ForkJoinPool pool) {
 557         RecursiveAction a = new CheckedRecursiveAction() {
 558             protected void realCompute() {
 559                 AsyncFib f = new AsyncFib(8);
 560                 assertSame(f, f.fork());
 561                 helpQuiesce();
 562                 while (!f.isDone()) // wait out race
 563                     ;
 564                 assertEquals(0, getQueuedTaskCount());
 565                 f.checkCompletedNormally();
 566             }};
 567         testInvokeOnPool(pool, a);
 568     }
 569 
 570     /**
 571      * invoke task throws exception when task completes abnormally
 572      */
 573     public void testAbnormalInvoke() {
 574         testAbnormalInvoke(mainPool());
 575     }
 576     public void testAbnormalInvoke_Singleton() {
 577         testAbnormalInvoke(singletonPool());
 578     }
 579     public void testAbnormalInvoke(ForkJoinPool pool) {
 580         RecursiveAction a = new CheckedRecursiveAction() {
 581             protected void realCompute() {
 582                 FailingAsyncFib f = new FailingAsyncFib(8);
 583                 try {


< prev index next >