ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ThreadPoolExecutorTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ThreadPoolExecutorTest.java (file contents):
Revision 1.38 by jsr166, Wed Nov 17 23:12:31 2010 UTC vs.
Revision 1.41 by dl, Fri May 6 11:22:08 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   * Other contributors include Andrew Wright, Jeffrey Hayes,
6   * Pat Fisher, Mike Judd.
7   */
# Line 154 | Line 154 | public class ThreadPoolExecutorTest exte
154              assertEquals(0, p.getCompletedTaskCount());
155              threadProceed.countDown();
156              threadDone.await();
157 <            Thread.sleep(SHORT_DELAY_MS);
157 >            delay(SHORT_DELAY_MS);
158              assertEquals(1, p.getCompletedTaskCount());
159          } finally {
160              joinPool(p);
# Line 406 | Line 406 | public class ThreadPoolExecutorTest exte
406          try {
407              p.execute(new CheckedRunnable() {
408                  public void realRun() throws InterruptedException {
409                    threadStarted.countDown();
409                      assertFalse(p.isTerminated());
410 +                    threadStarted.countDown();
411                      done.await();
412                  }});
413              assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS));
414 +            assertFalse(p.isTerminating());
415              done.countDown();
416          } finally {
417              try { p.shutdown(); } catch (SecurityException ok) { return; }
# Line 1344 | Line 1345 | public class ThreadPoolExecutorTest exte
1345          try {
1346              TrackedNoOpRunnable r = new TrackedNoOpRunnable();
1347              p.execute(r);
1348 <            Thread.sleep(SHORT_DELAY_MS);
1348 >            delay(SHORT_DELAY_MS);
1349              assertTrue(r.done);
1350              assertTrue(p.beforeCalled);
1351              assertTrue(p.afterCalled);
# Line 1918 | Line 1919 | public class ThreadPoolExecutorTest exte
1919              for (int i = 0; i < (MEDIUM_DELAY_MS/10); i++) {
1920                  if (p.getPoolSize() == 0)
1921                      break;
1922 <                Thread.sleep(10);
1922 >                delay(10);
1923              }
1924              assertEquals(0, p.getPoolSize());
1925          } finally {
# Line 1942 | Line 1943 | public class ThreadPoolExecutorTest exte
1943                      threadStarted.countDown();
1944                      assertTrue(p.getPoolSize() >= 1);
1945                  }});
1946 <            Thread.sleep(SMALL_DELAY_MS);
1946 >            delay(SMALL_DELAY_MS);
1947              assertTrue(p.getPoolSize() >= 1);
1948          } finally {
1949              joinPool(p);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines