You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2011/09/23 20:50:15 UTC

svn commit: r1174952 - /activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/Scheduler.java

Author: tabish
Date: Fri Sep 23 18:50:15 2011
New Revision: 1174952

URL: http://svn.apache.org/viewvc?rev=1174952&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQ-3031	

Don't use the scheduleAtFixedRate method in our scheduler as we
don't really have a need for real time task execution, just use
the fixed delay scheduler so that jobs don't stack up.

Modified:
    activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/Scheduler.java

Modified: activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/Scheduler.java
URL: http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/Scheduler.java?rev=1174952&r1=1174951&r2=1174952&view=diff
==============================================================================
--- activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/Scheduler.java (original)
+++ activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/Scheduler.java Fri Sep 23 18:50:15 2011
@@ -21,26 +21,26 @@ import java.util.Timer;
 import java.util.TimerTask;
 
 /**
- * 
+ *
  */
 public final class Scheduler {
 
-    
 
-	public static final Timer CLOCK_DAEMON = new Timer("KahaDB Scheduler", true);
+
+    public static final Timer CLOCK_DAEMON = new Timer("KahaDB Scheduler", true);
     private static final HashMap<Runnable, TimerTask> TIMER_TASKS = new HashMap<Runnable, TimerTask>();
 
     private Scheduler() {
     }
 
     public static synchronized void executePeriodically(final Runnable task, long period) {
-    	TimerTask timerTask = new SchedulerTimerTask(task);
-        CLOCK_DAEMON.scheduleAtFixedRate(timerTask, period, period);
+        TimerTask timerTask = new SchedulerTimerTask(task);
+        CLOCK_DAEMON.schedule(timerTask, period, period);
         TIMER_TASKS.put(task, timerTask);
     }
 
     public static synchronized void cancel(Runnable task) {
-    	TimerTask ticket = TIMER_TASKS.remove(task);
+        TimerTask ticket = TIMER_TASKS.remove(task);
         if (ticket != null) {
             ticket.cancel();
             CLOCK_DAEMON.purge();//remove cancelled TimerTasks
@@ -48,10 +48,10 @@ public final class Scheduler {
     }
 
     public static void executeAfterDelay(final Runnable task, long redeliveryDelay) {
-    	TimerTask timerTask = new SchedulerTimerTask(task);
+        TimerTask timerTask = new SchedulerTimerTask(task);
         CLOCK_DAEMON.schedule(timerTask, redeliveryDelay);
     }
-    
+
     public static void shutdown() {
         CLOCK_DAEMON.cancel();
     }