From 8d0b2b37dbacb2d9dbf883ae2ff0e308fc33774f Mon Sep 17 00:00:00 2001 From: Stefan Derkits Date: Tue, 11 Jun 2013 15:33:45 +0200 Subject: [PATCH] only call runMigration() in Schedulers that extend AbstractSchedulerWithMigration --- src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java | 5 +---- .../lsdc/sched/AbstractSchedulerWithMigration.java | 11 ++++++++++- src/at/ac/tuwien/lsdc/sched/SchedulerA.java | 5 ----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java b/src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java index c6a3779..08735a4 100644 --- a/src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java +++ b/src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java @@ -189,7 +189,7 @@ public abstract class AbstractScheduler { * * @param events the events to be read and used by the scheduler */ - private void handleEvents(HashMap> events) { + protected void handleEvents(HashMap> 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 events); - protected abstract void runMigration(); - /** * handle running of outsourced apps. * diff --git a/src/at/ac/tuwien/lsdc/sched/AbstractSchedulerWithMigration.java b/src/at/ac/tuwien/lsdc/sched/AbstractSchedulerWithMigration.java index 96a93ba..e0fff5a 100644 --- a/src/at/ac/tuwien/lsdc/sched/AbstractSchedulerWithMigration.java +++ b/src/at/ac/tuwien/lsdc/sched/AbstractSchedulerWithMigration.java @@ -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> events) { + super.handleEvents(events); + runMigration(); + } + /** * Check if we can free up a VM to shut it down. */ - @Override protected void runMigration() { List pms = manager.getSortedPMs(); // iterate through all the PMs (except the one with the highest utilization) diff --git a/src/at/ac/tuwien/lsdc/sched/SchedulerA.java b/src/at/ac/tuwien/lsdc/sched/SchedulerA.java index 6230ec2..7cf8613 100644 --- a/src/at/ac/tuwien/lsdc/sched/SchedulerA.java +++ b/src/at/ac/tuwien/lsdc/sched/SchedulerA.java @@ -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 sortApps(LinkedList events) { List sortedApps = new LinkedList(); -- 2.43.0