public void testIsQuiescent() throws Exception {
  ForkJoinPool p=new ForkJoinPool(2);
  PoolCleaner cleaner=null;
  try {
    cleaner=cleaner(p);
    assertTrue(p.isQuiescent());
    long startTime=System.nanoTime();
    FibTask f=new FibTask(20);
    p.invoke(f);
    assertSame(ForkJoinPool.defaultForkJoinWorkerThreadFactory,p.getFactory());
    while (!p.isQuiescent()) {
      if (millisElapsedSince(startTime) > LONG_DELAY_MS)       throw new AssertionFailedError("timed out");
      assertFalse(p.getAsyncMode());
      assertFalse(p.isShutdown());
      assertFalse(p.isTerminating());
      assertFalse(p.isTerminated());
      Thread.yield();
    }
    assertTrue(p.isQuiescent());
    assertFalse(p.getAsyncMode());
    assertEquals(0,p.getQueuedTaskCount());
    assertEquals(0,p.getQueuedSubmissionCount());
    assertFalse(p.hasQueuedSubmissions());
    while (p.getActiveThreadCount() != 0 && millisElapsedSince(startTime) < LONG_DELAY_MS)     Thread.yield();
    assertFalse(p.isShutdown());
    assertFalse(p.isTerminating());
    assertFalse(p.isTerminated());
    assertTrue(f.isDone());
    assertEquals(6765,(int)f.get());
    assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
  }
  finally {
    if (cleaner != null) {
      cleaner.close();
    }
  }
}

public void testIsQuiescent ( ) throws Exception { ForkJoinPool p = new ForkJoinPool ( 2 ) ; PoolCleaner cleaner = null ; try { cleaner = cleaner ( p ) ; assertTrue ( p . isQuiescent ( ) ) ; long startTime = System . nanoTime ( ) ; FibTask f = new FibTask ( 20 ) ; p . invoke ( f ) ; assertSame ( ForkJoinPool . defaultForkJoinWorkerThreadFactory , p . getFactory ( ) ) ; while ( ! p . isQuiescent ( ) ) { if ( millisElapsedSince ( startTime ) > LONG_DELAY_MS ) throw new AssertionFailedError ( "timed out" ) ; assertFalse ( p . getAsyncMode ( ) ) ; assertFalse ( p . isShutdown ( ) ) ; assertFalse ( p . isTerminating ( ) ) ; assertFalse ( p . isTerminated ( ) ) ; Thread . yield ( ) ; } assertTrue ( p . isQuiescent ( ) ) ; assertFalse ( p . getAsyncMode ( ) ) ; assertEquals ( 0 , p . getQueuedTaskCount ( ) ) ; assertEquals ( 0 , p . getQueuedSubmissionCount ( ) ) ; assertFalse ( p . hasQueuedSubmissions ( ) ) ; while ( p . getActiveThreadCount ( ) != 0 && millisElapsedSince ( startTime ) < LONG_DELAY_MS ) Thread . yield ( ) ; assertFalse ( p . isShutdown ( ) ) ; assertFalse ( p . isTerminating ( ) ) ; assertFalse ( p . isTerminated ( ) ) ; assertTrue ( f . isDone ( ) ) ; assertEquals ( 6765 , ( int ) f . get ( ) ) ; assertTrue ( millisElapsedSince ( startTime ) < LONG_DELAY_MS ) ; } finally { if ( cleaner != null ) { cleaner . close ( ) ; } } }
after invoking a single task , isquiescent eventually becomes true , at which time queues are empty , threads are not active , the task has completed successfully , and construction parameters continue to hold
