hu.mta.sztaki.lpds.cloud.simulator.iaas
Class PhysicalMachine.PowerStateDelayer

java.lang.Object
  extended by hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.ConsumptionEventAdapter
      extended by hu.mta.sztaki.lpds.cloud.simulator.iaas.PhysicalMachine.PowerStateDelayer
All Implemented Interfaces:
ResourceConsumption.ConsumptionEvent
Enclosing class:
PhysicalMachine

public class PhysicalMachine.PowerStateDelayer
extends ConsumptionEventAdapter

This class handles the delays and activites during the power state change procedures (e.g., switching off/turning on)

Author:
"Gabor Kecskemeti, Distributed and Parallel Systems Group, University of Innsbruck (c) 2013" "Gabor Kecskemeti, Laboratory of Parallel and Distributed Systems, MTA SZTAKI (c) 2014-"

Field Summary
(package private)  ResourceConsumption currentConsumption
          What is the actual resource consumption (task) that is executed on the PM's direct consumer (i.e.
private  PhysicalMachine.State newState
          The state that the delayer must switch to after the power state change has finished its activites.
(package private)  gnu.trove.list.linked.TDoubleLinkedList tasksDue
          The list of tasks to do for the particular power state change.
 long transitionStart
          when did the particular power state transition start
 
Constructor Summary
PhysicalMachine.PowerStateDelayer(double[] tasklist, PhysicalMachine.State newPowerState)
          The constructor of the delayer, it allows the specification of the tasks (that represent the boot/shutdown or similar operations) to be done before the power state can be achieved.
 
Method Summary
 void addFurtherTasks(double[] tasklist)
          if there seems to be further operations needed before the particular power state can be achieved then this function should be called.
 void conCancelled(ResourceConsumption problematic)
          if we receive a cancelled event we consider it as an unexpected behavior and throw an exception.
 void conComplete()
          the notification handler when a task from the tasklist is complete this handler actually sends the next task in.
private  void sendTask()
          this function picks the next item (i.e.
 void setNewState(PhysicalMachine.State newState)
          if after the list of tasks are completed we need to reach a different power state than initially planned then this is the function to go for.
 
Methods inherited from class hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.ConsumptionEventAdapter
isCancelled, isCompleted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

newState

private PhysicalMachine.State newState
The state that the delayer must switch to after the power state change has finished its activites.


tasksDue

final gnu.trove.list.linked.TDoubleLinkedList tasksDue
The list of tasks to do for the particular power state change. These tasks are expected to represent activities like the boot process. IMPORTANT: For performance reasons, the list is handled from its tailing:


transitionStart

public final long transitionStart
when did the particular power state transition start


currentConsumption

ResourceConsumption currentConsumption
What is the actual resource consumption (task) that is executed on the PM's direct consumer (i.e. the pure machine)

Constructor Detail

PhysicalMachine.PowerStateDelayer

public PhysicalMachine.PowerStateDelayer(double[] tasklist,
                                         PhysicalMachine.State newPowerState)
The constructor of the delayer, it allows the specification of the tasks (that represent the boot/shutdown or similar operations) to be done before the power state can be achieved.

Parameters:
tasklist - the tasks to execute in a serial order before the the specific power state can be set. IMPORTANT: For performance reasons, the list is handled from its tailing:
  • The last item is always the amount processing to be done in the upcoming task of the power change
  • the penultimate item is always the maximum amount of processing to be done in a single tick for the above task.
newPowerState - the power state to be set after completing all the above tasks.
Method Detail

sendTask

private void sendTask()
this function picks the next item (i.e. always the very last members of the list) from the tasklist and executes it, the function also ensures that the powerstatedelayer object will receive a notification once the task is completed. if there are no further tasks to execute this function even sets the new power state of the physical machine with the PM's corresponding function.


conComplete

public void conComplete()
the notification handler when a task from the tasklist is complete this handler actually sends the next task in.

Specified by:
conComplete in interface ResourceConsumption.ConsumptionEvent
Overrides:
conComplete in class ConsumptionEventAdapter

conCancelled

public void conCancelled(ResourceConsumption problematic)
if we receive a cancelled event we consider it as an unexpected behavior and throw an exception. When enabling faults in the system this behavior might need to change.

Specified by:
conCancelled in interface ResourceConsumption.ConsumptionEvent
Overrides:
conCancelled in class ConsumptionEventAdapter
Parameters:
problematic - the task that did not succeed

addFurtherTasks

public void addFurtherTasks(double[] tasklist)
if there seems to be further operations needed before the particular power state can be achieved then this function should be called. This function is especially useful to model cases when one state change has already started but then the user opts for another one before the previous state change can complete

Parameters:
tasklist - the new tasks to be included

setNewState

public void setNewState(PhysicalMachine.State newState)
if after the list of tasks are completed we need to reach a different power state than initially planned then this is the function to go for. This is an optional operation, you only need to call it if the PM started to go for some other state beforehand that you don't like.

Parameters:
newState - the new power state to switch to after all tasks complete


Copyright © 2012–2015 University of Innsbruck & MTA SZTAKI. All rights reserved.