jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java
changeset 7976 f273c0d04215
parent 7518 0282db800fe1
child 9242 ef138d47df58
--- 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()) {