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

java.lang.Object
  extended by hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.ResourceConsumption
Direct Known Subclasses:
NetworkNode.SingleTransfer

public class ResourceConsumption
extends Object

The instances of this class represent an individual resource consumption in the system. The visibility of the class and its members are defined so the compiler does not need to generate access methods for the members thus allowing fast and prompt changes in its contents. Upon setting up the consumption, every instance is registered at the provider and the consumer resource spreaders. Once the consumption is completed these registrations should be dropped. WARNING this is an internal representation of the consumption. This class is not supposed to be used outside of the context of the ResourceModel.

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

Nested Class Summary
static interface ResourceConsumption.ConsumptionEvent
          This interface allows its implementors to get notified when a consumption completes.
 
Field Summary
private  long completionDistance
           
private  ResourceSpreader consumer
           
(package private)  double consumerLimit
           
(package private)  ResourceConsumption.ConsumptionEvent ev
          The event to be fired when there is nothing left to process in this consumption.
private  double halfRealLimit
           
private  double hardLimit
           
(package private)  boolean inassginmentprocess
           
static Comparator<ResourceConsumption> limitComparator
           
(package private)  double limithelper
           
private  double processingLimit
           
private  ResourceSpreader provider
           
(package private)  double providerLimit
           
private  double realLimit
           
private  boolean registered
           
private  double requestedLimit
           
private  boolean resumable
           
private  double toBeProcessed
          The remaining unprocessed entities (e.g., remaining bytes of a transfer)
(package private)  boolean unassigned
           
private  double underProcessing
          The currently processing entities (e.g., a network buffer)
static double unlimitedProcessing
           
 
Constructor Summary
ResourceConsumption(double total, double limit, ResourceSpreader consumer, ResourceSpreader provider, ResourceConsumption.ConsumptionEvent e)
          This constructor describes the basic properties of an individual resource consumption.
 
Method Summary
private  void calcCompletionDistance()
           
 void cancel()
           
(package private)  double doConsumerProcessing(long ticksPassed)
           
(package private)  double doProviderProcessing(long ticksPassed)
           
 long getCompletionDistance()
           
 ResourceSpreader getConsumer()
           
 double getHardLimit()
           
 double getProcessingLimit()
           
 ResourceSpreader getProvider()
           
 double getRealLimit()
           
 double getToBeProcessed()
           
 double getUnderProcessing()
           
 double getUnProcessed()
           
 boolean isRegistered()
           
 boolean isResumable()
           
 boolean registerConsumption()
           
 void setConsumer(ResourceSpreader consumer)
           
(package private)  double setProcessingLimit(double pl)
           
 void setProvider(ResourceSpreader provider)
           
private  void setRealLimit(double rL)
           
 void suspend()
           
 String toString()
           
private  void updateHardLimit()
           
(package private)  double updateRealLimit(boolean updateCD)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

limitComparator

public static final Comparator<ResourceConsumption> limitComparator

unlimitedProcessing

public static final double unlimitedProcessing
See Also:
Constant Field Values

underProcessing

private double underProcessing
The currently processing entities (e.g., a network buffer)


toBeProcessed

private double toBeProcessed
The remaining unprocessed entities (e.g., remaining bytes of a transfer)


processingLimit

private double processingLimit

requestedLimit

private double requestedLimit

hardLimit

private double hardLimit

realLimit

private double realLimit

halfRealLimit

private double halfRealLimit

completionDistance

private long completionDistance

providerLimit

double providerLimit

consumerLimit

double consumerLimit

limithelper

double limithelper

unassigned

boolean unassigned

inassginmentprocess

boolean inassginmentprocess

ev

final ResourceConsumption.ConsumptionEvent ev
The event to be fired when there is nothing left to process in this consumption. If this variable is null then the event was already fired.


consumer

private ResourceSpreader consumer

provider

private ResourceSpreader provider

resumable

private boolean resumable

registered

private boolean registered
Constructor Detail

ResourceConsumption

public ResourceConsumption(double total,
                           double limit,
                           ResourceSpreader consumer,
                           ResourceSpreader provider,
                           ResourceConsumption.ConsumptionEvent e)
This constructor describes the basic properties of an individual resource consumption.

Parameters:
total - The amount of processing to be done during the lifetime of the just created object
e - Specify here the event to be fired when the just created object completes its transfers. With this event it is possible to notify the entity who initiated the transfer.
Method Detail

updateHardLimit

private void updateHardLimit()

registerConsumption

public boolean registerConsumption()

getUnProcessed

public double getUnProcessed()

cancel

public void cancel()

suspend

public void suspend()

setProvider

public void setProvider(ResourceSpreader provider)

setConsumer

public void setConsumer(ResourceSpreader consumer)

calcCompletionDistance

private void calcCompletionDistance()

doProviderProcessing

double doProviderProcessing(long ticksPassed)

doConsumerProcessing

double doConsumerProcessing(long ticksPassed)

getToBeProcessed

public double getToBeProcessed()

getUnderProcessing

public double getUnderProcessing()

setProcessingLimit

double setProcessingLimit(double pl)

getProcessingLimit

public double getProcessingLimit()

getRealLimit

public double getRealLimit()

getCompletionDistance

public long getCompletionDistance()

getConsumer

public ResourceSpreader getConsumer()

getProvider

public ResourceSpreader getProvider()

setRealLimit

private void setRealLimit(double rL)

updateRealLimit

double updateRealLimit(boolean updateCD)

toString

public String toString()
Overrides:
toString in class Object

isRegistered

public boolean isRegistered()

isResumable

public boolean isResumable()

getHardLimit

public double getHardLimit()


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