From 5a7e0270ed9a088c3f71d9a0e021ceb87133cd45 Mon Sep 17 00:00:00 2001 From: Stefan Derkits Date: Tue, 11 Jun 2013 11:44:43 +0200 Subject: [PATCH] move outsourced event handling from SchedulerB to AbstractScheduler --- .../tuwien/lsdc/sched/AbstractScheduler.java | 28 +++++++++++++++++++ src/at/ac/tuwien/lsdc/sched/SchedulerB.java | 28 ------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java b/src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java index 2305c3e..e2eb2be 100644 --- a/src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java +++ b/src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java @@ -204,6 +204,34 @@ public abstract class AbstractScheduler { */ protected abstract void handleEvents(LinkedList events); + /** + * handle running of outsourced apps. + * + * @param events list of all events that happened in this timeslot. + */ + protected void handleOutsourcedStartEvents(LinkedList events) { + for (SchedulerEvent evt : events) { + if (evt.getType() == EventType.startOutsourcedApplication) { + insertOutsourcedStopEvent(currTime + evt.getApp().getDuration(), evt.getApp()); + numCurrOutSourced++; + numTotalOutSourced++; + } + } + } + + /** + * handle stopping of outsourced apps. + * + * @param events list of all events that happened in this timeslot. + */ + protected void handleOutsourcedEndEvents(LinkedList events) { + for (SchedulerEvent evt : events) { + if (evt.getType() == EventType.endOutsourcedApplication) { + numCurrOutSourced--; + } + } + } + /** * Does the logging for each timestamp. It uses the CSVLogger to write directly to the specific * scheduler/scenario csv file diff --git a/src/at/ac/tuwien/lsdc/sched/SchedulerB.java b/src/at/ac/tuwien/lsdc/sched/SchedulerB.java index a14e27b..d1f7d0a 100644 --- a/src/at/ac/tuwien/lsdc/sched/SchedulerB.java +++ b/src/at/ac/tuwien/lsdc/sched/SchedulerB.java @@ -54,34 +54,6 @@ public class SchedulerB extends AbstractScheduler { handleStartEvents(events); } - /** - * handle running of outsourced apps. - * - * @param events list of all events that happened in this timeslot. - */ - private void handleOutsourcedStartEvents(LinkedList events) { - for (SchedulerEvent evt : events) { - if (evt.getType() == EventType.startOutsourcedApplication) { - insertOutsourcedStopEvent(currTime + evt.getApp().getDuration(), evt.getApp()); - numCurrOutSourced++; - numTotalOutSourced++; - } - } - } - - /** - * handle stopping of outsourced apps. - * - * @param events list of all events that happened in this timeslot. - */ - private void handleOutsourcedEndEvents(LinkedList events) { - for (SchedulerEvent evt : events) { - if (evt.getType() == EventType.endOutsourcedApplication) { - numCurrOutSourced--; - } - } - } - /** * Check if we have any delayed apps. Try to launch them. */ -- 2.43.0