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

Comparing jsr166/src/test/tck/ExecutorsTest.java (file contents):
Revision 1.35 by jsr166, Mon Oct 11 08:47:04 2010 UTC vs.
Revision 1.39 by dl, Fri May 6 11:22: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   * Other contributors include Andrew Wright, Jeffrey Hayes,
6   * Pat Fisher, Mike Judd.
7   */
# Line 191 | Line 191 | public class ExecutorsTest extends JSR16
191              Future f = p.schedule(Executors.callable(task, Boolean.TRUE),
192                                    SHORT_DELAY_MS, MILLISECONDS);
193              assertFalse(f.isDone());
194 <            assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS));
194 >            assertTrue(done.await(MEDIUM_DELAY_MS, MILLISECONDS));
195 >            assertSame(Boolean.TRUE, f.get(SMALL_DELAY_MS, MILLISECONDS));
196 >            assertSame(Boolean.TRUE, f.get());
197              assertTrue(f.isDone());
196            assertEquals(Boolean.TRUE, f.get());
198          } finally {
199              joinPool(p);
200          }
# Line 213 | Line 214 | public class ExecutorsTest extends JSR16
214              Future f = p.schedule(Executors.callable(task, Boolean.TRUE),
215                                    SHORT_DELAY_MS, MILLISECONDS);
216              assertFalse(f.isDone());
217 <            assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS));
217 >            assertTrue(done.await(MEDIUM_DELAY_MS, MILLISECONDS));
218 >            assertSame(Boolean.TRUE, f.get(SMALL_DELAY_MS, MILLISECONDS));
219 >            assertSame(Boolean.TRUE, f.get());
220              assertTrue(f.isDone());
218            assertEquals(Boolean.TRUE, f.get());
221          } finally {
222              joinPool(p);
223          }
# Line 237 | Line 239 | public class ExecutorsTest extends JSR16
239              Future f = p.schedule(Executors.callable(task, Boolean.TRUE),
240                                    SHORT_DELAY_MS, MILLISECONDS);
241              assertFalse(f.isDone());
242 <            assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS));
242 >            assertTrue(done.await(MEDIUM_DELAY_MS, MILLISECONDS));
243 >            assertSame(Boolean.TRUE, f.get(SMALL_DELAY_MS, MILLISECONDS));
244 >            assertSame(Boolean.TRUE, f.get());
245              assertTrue(f.isDone());
242            assertEquals(Boolean.TRUE, f.get());
246          } finally {
247              joinPool(p);
248          }
# Line 251 | Line 254 | public class ExecutorsTest extends JSR16
254      public void testTimedCallable() throws Exception {
255          final Runnable sleeper = new CheckedInterruptedRunnable() {
256              public void realRun() throws InterruptedException {
257 <                Thread.sleep(LONG_DELAY_MS);
257 >                delay(LONG_DELAY_MS);
258              }};
259          for (ExecutorService executor :
260                   new ExecutorService[] {
# Line 310 | Line 313 | public class ExecutorsTest extends JSR16
313          }
314  
315          try {
316 <            Thread.sleep(SHORT_DELAY_MS);
316 >            delay(SHORT_DELAY_MS);
317          } finally {
318              joinPool(e);
319          }
# Line 346 | Line 349 | public class ExecutorsTest extends JSR16
349                  ExecutorService e = Executors.newSingleThreadExecutor(Executors.privilegedThreadFactory());
350                  e.execute(r);
351                  e.shutdown();
352 <                Thread.sleep(SHORT_DELAY_MS);
352 >                delay(SHORT_DELAY_MS);
353                  joinPool(e);
354              }};
355  
# Line 501 | Line 504 | public class ExecutorsTest extends JSR16
504                  Executors.privilegedCallable(new CheckCCL()).call();
505              }};
506  
507 <         runWithPermissions(r,
507 >        runWithPermissions(r,
508                             new RuntimePermission("getClassLoader"),
509                             new RuntimePermission("setContextClassLoader"));
510      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines