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 |
|
*/ |
240 |
|
/** |
241 |
|
* schedule callable throws RejectedExecutionException if shutdown |
242 |
|
*/ |
243 |
< |
public void testSchedule3_RejectedExecutionException() throws InterruptedException { |
244 |
< |
ScheduledThreadPoolExecutor se = new ScheduledThreadPoolExecutor(1); |
245 |
< |
try { |
243 |
> |
public void testSchedule3_RejectedExecutionException() throws InterruptedException { |
244 |
> |
ScheduledThreadPoolExecutor se = new ScheduledThreadPoolExecutor(1); |
245 |
> |
try { |
246 |
|
se.shutdown(); |
247 |
|
se.schedule(new NoOpCallable(), |
248 |
|
MEDIUM_DELAY_MS, MILLISECONDS); |
250 |
|
} catch (RejectedExecutionException success) { |
251 |
|
} catch (SecurityException ok) { |
252 |
|
} |
253 |
< |
joinPool(se); |
253 |
> |
joinPool(se); |
254 |
|
} |
255 |
|
|
256 |
|
/** |
485 |
|
try { |
486 |
|
p.execute(new CheckedRunnable() { |
487 |
|
public void realRun() throws InterruptedException { |
488 |
– |
threadStarted.countDown(); |
488 |
|
assertFalse(p.isTerminated()); |
489 |
+ |
threadStarted.countDown(); |
490 |
|
done.await(); |
491 |
|
}}); |
492 |
|
assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); |
493 |
+ |
assertFalse(p.isTerminating()); |
494 |
|
done.countDown(); |
495 |
|
} finally { |
496 |
|
try { p.shutdown(); } catch (SecurityException ok) { return; } |
510 |
|
assertFalse(p.isTerminating()); |
511 |
|
p.execute(new CheckedRunnable() { |
512 |
|
public void realRun() throws InterruptedException { |
512 |
– |
threadStarted.countDown(); |
513 |
|
assertFalse(p.isTerminating()); |
514 |
+ |
threadStarted.countDown(); |
515 |
|
done.await(); |
516 |
|
}}); |
517 |
|
assertTrue(threadStarted.await(SMALL_DELAY_MS, MILLISECONDS)); |