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

Comparing jsr166/src/test/tck/ScheduledExecutorTest.java (file contents):
Revision 1.12 by dl, Thu Dec 25 19:48:57 2003 UTC vs.
Revision 1.16 by dl, Thu Jan 8 01:29:46 2004 UTC

# Line 1 | Line 1
1   /*
2 < * Written by members of JCP JSR-166 Expert Group and released to the
3 < * public domain. Use, modify, and redistribute this code in any way
4 < * without acknowledgement. Other contributors include Andrew Wright,
5 < * Jeffrey Hayes, Pat Fischer, Mike Judd.
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
5 > * Other contributors include Andrew Wright, Jeffrey Hayes,
6 > * Pat Fisher, Mike Judd.
7   */
8  
9   import junit.framework.*;
# Line 585 | Line 586 | public class ScheduledExecutorTest exten
586          try {
587              p1.setContinueExistingPeriodicTasksAfterShutdownPolicy(true);
588              ScheduledFuture task =
589 <                p1.scheduleAtFixedRate(new NoOpRunnable(), 5, 5, TimeUnit.MILLISECONDS);
589 >                p1.scheduleAtFixedRate(new NoOpRunnable(), 1, 1, TimeUnit.MILLISECONDS);
590              assertFalse(task.isCancelled());
591              p1.shutdown();
592              assertFalse(task.isCancelled());
# Line 593 | Line 594 | public class ScheduledExecutorTest exten
594              assertTrue(p1.isShutdown());
595              Thread.sleep(SHORT_DELAY_MS);
596              assertFalse(task.isCancelled());
597 <            task.cancel(true);
598 <            assertTrue(task.isCancelled());
597 >            assertTrue(task.cancel(true));
598 >            assertTrue(task.isDone());
599              Thread.sleep(SHORT_DELAY_MS);
600              assertTrue(p1.isTerminated());
601          }
# Line 1060 | Line 1061 | public class ScheduledExecutorTest exten
1061              ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1062              l.add(new StringTask());
1063              l.add(Executors.callable(new MediumPossiblyInterruptedRunnable(), TEST_STRING));
1064 +            l.add(new StringTask());
1065              List<Future<String>> result = e.invokeAll(l, SHORT_DELAY_MS, TimeUnit.MILLISECONDS);
1066 <            assertEquals(2, result.size());
1066 >            assertEquals(3, result.size());
1067              Iterator<Future<String>> it = result.iterator();
1068              Future<String> f1 = it.next();
1069              Future<String> f2 = it.next();
1070 +            Future<String> f3 = it.next();
1071              assertTrue(f1.isDone());
1069            assertFalse(f1.isCancelled());
1072              assertTrue(f2.isDone());
1073 +            assertTrue(f3.isDone());
1074 +            assertFalse(f1.isCancelled());
1075              assertTrue(f2.isCancelled());
1076          } catch(Exception ex) {
1077              unexpectedException();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines