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

Comparing jsr166/src/test/tck/ScheduledExecutorSubclassTest.java (file contents):
Revision 1.15 by jsr166, Mon Oct 11 07:21:32 2010 UTC vs.
Revision 1.19 by jsr166, Tue Mar 15 19:47:07 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   */
6  
7   import junit.framework.*;
# Line 535 | Line 535 | public class ScheduledExecutorSubclassTe
535          try {
536              p.execute(new CheckedRunnable() {
537                  public void realRun() throws InterruptedException {
538                    threadStarted.countDown();
538                      assertFalse(p.isTerminated());
539 +                    threadStarted.countDown();
540                      done.await();
541                  }});
542              assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS));
543 +            assertFalse(p.isTerminating());
544              done.countDown();
545          } finally {
546              try { p.shutdown(); } catch (SecurityException ok) { return; }
# Line 559 | Line 560 | public class ScheduledExecutorSubclassTe
560              assertFalse(p.isTerminating());
561              p.execute(new CheckedRunnable() {
562                  public void realRun() throws InterruptedException {
562                    threadStarted.countDown();
563                      assertFalse(p.isTerminating());
564 +                    threadStarted.countDown();
565                      done.await();
566                  }});
567              assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS));
# Line 721 | Line 722 | public class ScheduledExecutorSubclassTe
722      public void testShutDown2() throws InterruptedException {
723          CustomExecutor p = new CustomExecutor(1);
724          p.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
725 +        assertFalse(p.getExecuteExistingDelayedTasksAfterShutdownPolicy());
726 +        assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy());
727          ScheduledFuture[] tasks = new ScheduledFuture[5];
728          for (int i = 0; i < tasks.length; i++)
729              tasks[i] = p.schedule(new NoOpRunnable(),
# Line 745 | Line 748 | public class ScheduledExecutorSubclassTe
748       */
749      public void testShutDown3() throws InterruptedException {
750          CustomExecutor p = new CustomExecutor(1);
751 +        assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy());
752 +        assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy());
753          p.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
754 +        assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy());
755 +        assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy());
756          ScheduledFuture task =
757              p.scheduleAtFixedRate(new NoOpRunnable(), 5, 5, MILLISECONDS);
758          try { p.shutdown(); } catch (SecurityException ok) { return; }
# Line 764 | Line 771 | public class ScheduledExecutorSubclassTe
771       */
772      public void testShutDown4() throws InterruptedException {
773          CustomExecutor p = new CustomExecutor(1);
767        p.setContinueExistingPeriodicTasksAfterShutdownPolicy(true);
774          final CountDownLatch counter = new CountDownLatch(2);
775          try {
776 +            p.setContinueExistingPeriodicTasksAfterShutdownPolicy(true);
777 +            assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy());
778 +            assertTrue(p.getContinueExistingPeriodicTasksAfterShutdownPolicy());
779              final Runnable r = new CheckedRunnable() {
780                  public void realRun() {
781                      counter.countDown();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines