Class ScheduledResource
- java.lang.Object
-
- de.uka.ipd.sdq.simulation.abstractsimengine.SimulationElement
-
- de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator
-
- de.uka.ipd.sdq.simucomframework.entities.SimuComEntity
-
- de.uka.ipd.sdq.simucomframework.resources.AbstractScheduledResource
-
- de.uka.ipd.sdq.simucomframework.resources.ScheduledResource
-
- All Implemented Interfaces:
de.uka.ipd.sdq.scheduler.sensors.IActiveResourceStateSensor,de.uka.ipd.sdq.simulation.abstractsimengine.IEntity
- Direct Known Subclasses:
HDDResource
public class ScheduledResource extends AbstractScheduledResource
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancanBeUnavailable
-
Constructor Summary
Constructors Constructor Description ScheduledResource(org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification activeResource, SimuComModel myModel, String resourceContainerID, String schedulingStrategyID)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateResource()Called by the framework to inform that the resource should start its lifecycleprotected doublecalculateDemand(double demand)Template method.voidconsumeResource(SimuComSimProcess process, int resourceServiceID, Map<String,Serializable> parameterMap, double abstractDemand)Called by client of this resource to make the resource simulate resource processing.protected de.uka.ipd.sdq.scheduler.IActiveResourcecreateActiveResource(SimuComModel myModel)Subclasses are responsible for creating theIActiveResourceto use internally.voiddeactivateResource()Called by the framework to inform the resource that the simulation has been stopped.org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecificationgetActiveResource()doublegetFailureTime()Returns the failure time for this resource (or -1.0 if the resource cannot fail).static StringgetNextResourceId()doublegetRemainingDemandForProcess(SimuComSimProcess thread)doublegetRepairTime()Returns the repair time for this resource (or -1.0 if the resource cannot fail).de.uka.ipd.sdq.scheduler.IActiveResourcegetScheduledResource()voidsetProcessingRate(String newProcessingRate)Method to alter processing rate at runtime, e.g., to model changing parameters of cloud environments at runtimevoidupdate(long state, int instanceId)voidupdateDemand(SimuComSimProcess thread, double demand)-
Methods inherited from class de.uka.ipd.sdq.simucomframework.resources.AbstractScheduledResource
addDemandListener, addOverallUtilizationListener, addStateListener, assertAvailability, demandCompleted, fireDemand, fireOverallUtilization, fireStateEvent, getDescription, getNumberOfInstances, getQueueLength, getResourceTypeId, getSchedulingStrategyID, getUnderlyingResource, isAvailable, isRequiredByContainer, setAvailable
-
Methods inherited from class de.uka.ipd.sdq.simucomframework.entities.SimuComEntity
getModel
-
-
-
-
Constructor Detail
-
ScheduledResource
public ScheduledResource(org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification activeResource, SimuComModel myModel, String resourceContainerID, String schedulingStrategyID)
-
-
Method Detail
-
createActiveResource
protected de.uka.ipd.sdq.scheduler.IActiveResource createActiveResource(SimuComModel myModel)
Description copied from class:AbstractScheduledResourceSubclasses are responsible for creating theIActiveResourceto use internally. Is called in the constructor.- Specified by:
createActiveResourcein classAbstractScheduledResource- Returns:
- the
IActiveResourceresource to use as determined by the subclasses.
-
calculateDemand
protected double calculateDemand(double demand)
Description copied from class:AbstractScheduledResourceTemplate method. Implementers have to use the given demand and return the time span needed to process the demand on this resource.- Specified by:
calculateDemandin classAbstractScheduledResource- Parameters:
demand- The demand issued to this resource in units understood by the resource- Returns:
- The service time, given in seconds
-
activateResource
public void activateResource()
Description copied from class:AbstractScheduledResourceCalled by the framework to inform that the resource should start its lifecycle- Overrides:
activateResourcein classAbstractScheduledResource
-
consumeResource
public void consumeResource(SimuComSimProcess process, int resourceServiceID, Map<String,Serializable> parameterMap, double abstractDemand)
Description copied from class:AbstractScheduledResourceCalled by client of this resource to make the resource simulate resource processing. This is the queueing network service center part of our simulation. Allows passing of additional parameters.- Specified by:
consumeResourcein classAbstractScheduledResource- Parameters:
process- The thread or job requesting the processing of its demandresourceServiceID- The id of the resource service to be called for resource consumptionparameterMap- Additional parameters which can be used by the resource. Map can be empty.abstractDemand- The resource demand the client wishes to be processed by the resource
-
getRemainingDemandForProcess
public double getRemainingDemandForProcess(SimuComSimProcess thread)
- Specified by:
getRemainingDemandForProcessin classAbstractScheduledResource
-
updateDemand
public void updateDemand(SimuComSimProcess thread, double demand)
- Specified by:
updateDemandin classAbstractScheduledResource
-
deactivateResource
public void deactivateResource()
Description copied from class:AbstractScheduledResourceCalled by the framework to inform the resource that the simulation has been stopped. Fires aIStateListener#stateChanged()event.- Overrides:
deactivateResourcein classAbstractScheduledResource
-
getNextResourceId
public static String getNextResourceId()
-
getScheduledResource
public de.uka.ipd.sdq.scheduler.IActiveResource getScheduledResource()
- Specified by:
getScheduledResourcein classAbstractScheduledResource
-
setProcessingRate
public void setProcessingRate(String newProcessingRate)
Method to alter processing rate at runtime, e.g., to model changing parameters of cloud environments at runtime- Parameters:
newProcessingRate- The new processing rate of this resource
-
getActiveResource
public org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification getActiveResource()
-
getFailureTime
public double getFailureTime()
Returns the failure time for this resource (or -1.0 if the resource cannot fail).- Returns:
- the failure time for the resource
-
getRepairTime
public double getRepairTime()
Returns the repair time for this resource (or -1.0 if the resource cannot fail).- Returns:
- the repair time for the resource
-
update
public void update(long state, int instanceId)- Specified by:
updatein interfacede.uka.ipd.sdq.scheduler.sensors.IActiveResourceStateSensor- Overrides:
updatein classAbstractScheduledResource
-
-