only call runMigration() in Schedulers that extend AbstractSchedulerWithMigration
authorStefan Derkits <stefan@derkits.at>
Tue, 11 Jun 2013 13:33:45 +0000 (15:33 +0200)
committerStefan Derkits <stefan@derkits.at>
Tue, 11 Jun 2013 13:33:45 +0000 (15:33 +0200)
src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java
src/at/ac/tuwien/lsdc/sched/AbstractSchedulerWithMigration.java
src/at/ac/tuwien/lsdc/sched/SchedulerA.java

index c6a3779c9e7bf2f0aaaf732660899e9f69dde4ba..08735a4f7ddf8eede7e19d5cac239ef55c58299c 100644 (file)
@@ -189,7 +189,7 @@ public abstract class AbstractScheduler {
         *
         * @param events the events to be read and used by the scheduler
         */
-       private void handleEvents(HashMap<EventType, LinkedList<SchedulerEvent>> events) {
+       protected void handleEvents(HashMap<EventType, LinkedList<SchedulerEvent>> events) {
                if (events.containsKey(EventType.endApplication))
                        handleEndEvents(events.get(EventType.endApplication));
                if (events.containsKey(EventType.endOutsourcedApplication))
@@ -199,7 +199,6 @@ public abstract class AbstractScheduler {
                        handleOutsourcedStartEvents(events.get(EventType.startOutsourcedApplication));
                if (events.containsKey(EventType.startApplication))
                        handleStartEvents(events.get(EventType.startApplication));
-               runMigration();
        }
 
        protected void handleDelayedApps() {
@@ -216,8 +215,6 @@ public abstract class AbstractScheduler {
 
        protected abstract void handleStartEvents(LinkedList<SchedulerEvent> events);
 
-       protected abstract void runMigration();
-
        /**
         * handle running of outsourced apps.
         *
index 96a93ba435253d4cc5a82bbaa6b52d535f3a8609..e0fff5a7553dc4d761f0452e2794a4db2b4ed998 100644 (file)
@@ -2,11 +2,15 @@ package at.ac.tuwien.lsdc.sched;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.HashMap;
+import java.util.LinkedList;
 import java.util.List;
 
 import at.ac.tuwien.lsdc.types.Application;
 import at.ac.tuwien.lsdc.types.PhysicalMachine;
 import at.ac.tuwien.lsdc.types.ScenarioType;
+import at.ac.tuwien.lsdc.types.SchedulerEvent;
+import at.ac.tuwien.lsdc.types.SchedulerEvent.EventType;
 import at.ac.tuwien.lsdc.types.VirtualMachine;
 
 public abstract class AbstractSchedulerWithMigration extends AbstractScheduler {
@@ -16,10 +20,15 @@ public abstract class AbstractSchedulerWithMigration extends AbstractScheduler {
                super(numPMs, numCloudPartners, schedulerLog, scenario);
        }
 
+       @Override
+       protected void handleEvents(HashMap<EventType, LinkedList<SchedulerEvent>> events) {
+               super.handleEvents(events);
+               runMigration();
+       }
+
        /**
         * Check if we can free up a VM to shut it down.
         */
-       @Override
        protected void runMigration() {
                List<PhysicalMachine> pms = manager.getSortedPMs();
                // iterate through all the PMs (except the one with the highest utilization)
index 6230ec235c655225128d2078f741b1a7902bd7da..7cf8613ab4cbee3845f6767df55d8e0fe59d1b7c 100644 (file)
@@ -130,11 +130,6 @@ public class SchedulerA extends AbstractScheduler {
 
        }
 
-       @Override
-       protected void runMigration() {
-               // Scheduler A doesn't support Migration, nothing to do here
-       }
-
        // sorting applications by amount of resources (descending)
        private List<Application> sortApps(LinkedList<SchedulerEvent> events) {
                List<Application> sortedApps = new LinkedList<Application>();