Permalink
Browse files

JGRP-1457 don't lose scheduled tasks

  • Loading branch information...
1 parent d77c440 commit 624039a756c8ad60cf896cc5364f1c3d65b42202 @dimbleby dimbleby committed with Apr 22, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/org/jgroups/util/TimeScheduler2.java
@@ -162,8 +162,9 @@ public void execute(Runnable task) {
}
if((retval=existing.add(work)) != null)
break;
- else // entry has completed; remove it. This will create a new Entry at the top of the loop
- tasks.remove(key);
+
+ // Else the existing entry is completed. It'll be removed shortly, so we just loop round again.
+ // Don't remove the entry ourselves - see JGRP-1457.
}
if(key < next_execution_time || no_tasks.compareAndSet(true, false)) {
@@ -393,7 +394,7 @@ protected void stopRunner() {
}
-
+
private static class Entry {
private final MyTask task; // the task (wrapper) to execute
@@ -579,7 +580,7 @@ public void doSchedule() {
log.trace("task will not get rescheduled as interval is " + next_interval);
return;
}
-
+
future=schedule(this, next_interval, TimeUnit.MILLISECONDS);
if(cancelled)
future.cancel(true);

0 comments on commit 624039a

Please sign in to comment.