671 |
|
public void testShutDown2() throws InterruptedException { |
672 |
|
ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); |
673 |
|
p.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); |
674 |
+ |
assertFalse(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); |
675 |
+ |
assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); |
676 |
|
ScheduledFuture[] tasks = new ScheduledFuture[5]; |
677 |
|
for (int i = 0; i < tasks.length; i++) |
678 |
|
tasks[i] = p.schedule(new NoOpRunnable(), |
696 |
|
*/ |
697 |
|
public void testShutDown3() throws InterruptedException { |
698 |
|
ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); |
699 |
+ |
assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); |
700 |
+ |
assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); |
701 |
|
p.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); |
702 |
+ |
assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); |
703 |
+ |
assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); |
704 |
|
ScheduledFuture task = |
705 |
|
p.scheduleAtFixedRate(new NoOpRunnable(), 5, 5, MILLISECONDS); |
706 |
|
try { p.shutdown(); } catch (SecurityException ok) { return; } |
719 |
|
*/ |
720 |
|
public void testShutDown4() throws InterruptedException { |
721 |
|
ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); |
716 |
– |
p.setContinueExistingPeriodicTasksAfterShutdownPolicy(true); |
722 |
|
final CountDownLatch counter = new CountDownLatch(2); |
723 |
|
try { |
724 |
+ |
p.setContinueExistingPeriodicTasksAfterShutdownPolicy(true); |
725 |
+ |
assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); |
726 |
+ |
assertTrue(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); |
727 |
|
final Runnable r = new CheckedRunnable() { |
728 |
|
public void realRun() { |
729 |
|
counter.countDown(); |