721 |
|
public void testShutDown2() throws InterruptedException { |
722 |
|
CustomExecutor p = new CustomExecutor(1); |
723 |
|
p.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); |
724 |
+ |
assertFalse(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); |
725 |
+ |
assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); |
726 |
|
ScheduledFuture[] tasks = new ScheduledFuture[5]; |
727 |
|
for (int i = 0; i < tasks.length; i++) |
728 |
|
tasks[i] = p.schedule(new NoOpRunnable(), |
747 |
|
*/ |
748 |
|
public void testShutDown3() throws InterruptedException { |
749 |
|
CustomExecutor p = new CustomExecutor(1); |
750 |
+ |
assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); |
751 |
+ |
assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); |
752 |
|
p.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); |
753 |
+ |
assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); |
754 |
+ |
assertFalse(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); |
755 |
|
ScheduledFuture task = |
756 |
|
p.scheduleAtFixedRate(new NoOpRunnable(), 5, 5, MILLISECONDS); |
757 |
|
try { p.shutdown(); } catch (SecurityException ok) { return; } |
770 |
|
*/ |
771 |
|
public void testShutDown4() throws InterruptedException { |
772 |
|
CustomExecutor p = new CustomExecutor(1); |
767 |
– |
p.setContinueExistingPeriodicTasksAfterShutdownPolicy(true); |
773 |
|
final CountDownLatch counter = new CountDownLatch(2); |
774 |
|
try { |
775 |
+ |
p.setContinueExistingPeriodicTasksAfterShutdownPolicy(true); |
776 |
+ |
assertTrue(p.getExecuteExistingDelayedTasksAfterShutdownPolicy()); |
777 |
+ |
assertTrue(p.getContinueExistingPeriodicTasksAfterShutdownPolicy()); |
778 |
|
final Runnable r = new CheckedRunnable() { |
779 |
|
public void realRun() { |
780 |
|
counter.countDown(); |