← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3850: Minor fix in scheduling manager

 

------------------------------------------------------------
revno: 3850
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-06-07 12:35:56 +0200
message:
  Minor fix in scheduling manager
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DefaultSchedulingManager.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/SchedulingManager.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DefaultSchedulingManager.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DefaultSchedulingManager.java	2011-05-14 19:41:19 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DefaultSchedulingManager.java	2011-06-07 10:35:56 +0000
@@ -35,6 +35,8 @@
 import org.hisp.dhis.options.SystemSettingManager;
 import org.hisp.dhis.system.scheduling.Scheduler;
 
+import static org.hisp.dhis.system.scheduling.Scheduler.*;
+
 /**
  * @author Lars Helge Overland
  */
@@ -72,7 +74,7 @@
 
     public void scheduleTasks()
     {
-        scheduler.scheduleTask( getRunnables(), Scheduler.CRON_NIGHTLY_1AM );
+        scheduler.scheduleTask( getRunnables(), CRON_NIGHTLY_1AM );
     }
     
     public void stopTasks()
@@ -90,13 +92,15 @@
         return scheduler.getTaskStatus( Runnables.class );
     }
     
-    public Set<String> getRunningTaskKeys()
+    public Set<String> getScheduledTaskKeys()
     {
         final Set<String> keys = new HashSet<String>();
         
         for ( String key : tasks.keySet() )
         {
-            if ( Scheduler.STATUS_RUNNING.equals( scheduler.getTaskStatus( tasks.get( key ).getClass() ) ) )
+            boolean schedule = (Boolean) systemSettingManager.getSystemSetting( key, false );
+            
+            if ( schedule )
             {
                 keys.add( key );
             }
@@ -121,10 +125,6 @@
             {
                 runnables.addRunnable( tasks.get( key ) );
             }
-            else
-            {
-                scheduler.stopTask( tasks.get( key ).getClass() );
-            }
         }
         
         return runnables;

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/SchedulingManager.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/SchedulingManager.java	2011-05-14 19:41:19 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/SchedulingManager.java	2011-06-07 10:35:56 +0000
@@ -42,5 +42,5 @@
     
     String getTaskStatus();
     
-    Set<String> getRunningTaskKeys();
+    Set<String> getScheduledTaskKeys();
 }