hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel
Class ConsumptionEventAdapter

java.lang.Object
  extended by hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.ConsumptionEventAdapter
All Implemented Interfaces:
ResourceConsumption.ConsumptionEvent
Direct Known Subclasses:
PhysicalMachine.PowerStateDelayer, VirtualMachine.InitialTransferEvent

public class ConsumptionEventAdapter
extends Object
implements ResourceConsumption.ConsumptionEvent

This class simplifies the implementation of consumption events and provides basic functions to determine if a resource consumption has already been completed (either with a failure or success). The simplification allows the following: Instead of implementing the complete consumption event interface, one can only concentrate on actions to do on success/failure only.

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

Field Summary
private  boolean cancelled
          shows if the resource consumption has failed to complete for some reason
private  boolean completed
          shows if the resource consumption has successfully completed
 
Constructor Summary
ConsumptionEventAdapter()
           
 
Method Summary
 void conCancelled(ResourceConsumption problematic)
          This function simply marks the failure of the consumption in the cancelled field of the class.
 void conComplete()
          This function simply marks the success of the consumption in the completed field of the class.
 boolean isCancelled()
          Determines whether there was a failure in the resource consumption this event adapter is/was observing
 boolean isCompleted()
          Determines if successful completion was marked for the resource consumption this event adapter is/was observing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cancelled

private boolean cancelled
shows if the resource consumption has failed to complete for some reason


completed

private boolean completed
shows if the resource consumption has successfully completed

Constructor Detail

ConsumptionEventAdapter

public ConsumptionEventAdapter()
Method Detail

conComplete

public void conComplete()
This function simply marks the success of the consumption in the completed field of the class. If this function is overridden please make sure super.conComplete() is called (this allows the other functions of this class to still operate correctly).

Specified by:
conComplete in interface ResourceConsumption.ConsumptionEvent

conCancelled

public void conCancelled(ResourceConsumption problematic)
This function simply marks the failure of the consumption in the cancelled field of the class. If this function is overridden please make sure super.conCancelled() is called (this allows the other functions of this class to still operate correctly).

Specified by:
conCancelled in interface ResourceConsumption.ConsumptionEvent

isCancelled

public boolean isCancelled()
Determines whether there was a failure in the resource consumption this event adapter is/was observing

Returns:
true if the consumption has failed

isCompleted

public boolean isCompleted()
Determines if successful completion was marked for the resource consumption this event adapter is/was observing

Returns:
true if the consumption has successfully terminated


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