--- a/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java Tue Jan 11 13:42:34 2011 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java Wed Jan 12 14:40:36 2011 +0000
@@ -360,8 +360,12 @@
getExecuteExistingDelayedTasksAfterShutdownPolicy();
boolean keepPeriodic =
getContinueExistingPeriodicTasksAfterShutdownPolicy();
- if (!keepDelayed && !keepPeriodic)
+ if (!keepDelayed && !keepPeriodic) {
+ for (Object e : q.toArray())
+ if (e instanceof RunnableScheduledFuture<?>)
+ ((RunnableScheduledFuture<?>) e).cancel(false);
q.clear();
+ }
else {
// Traverse snapshot to avoid iterator exceptions
for (Object e : q.toArray()) {