public abstract class AbstractScheduledResource extends SimuComEntity implements IActiveResourceStateSensor
Constructor and Description |
---|
AbstractScheduledResource(SimuComModel myModel,
String typeID,
String resourceContainerID,
String resourceTypeID,
String description,
String schedulingStrategyID,
int numberOfInstances,
boolean requiredByContainer) |
Modifier and Type | Method and Description |
---|---|
void |
activateResource()
Called by the framework to inform that the resource should start its lifecycle
|
void |
addDemandListener(IDemandListener listener) |
void |
addOverallUtilizationListener(IOverallUtilizationListener listener) |
void |
addStateListener(IStateListener listener,
int instance) |
abstract void |
consumeResource(SimuComSimProcess thread,
int resourceServiceID,
Map<String,Serializable> parameterMap,
double demand)
Called by client of this resource to make the resource simulate resource processing.
|
void |
deactivateResource()
Called by the framework to inform the resource that the simulation has been stopped.
|
void |
demandCompleted(ISchedulableProcess simProcess)
Notifies the sensor about a process whose demand has been completed by the resource.
|
String |
getDescription() |
int |
getNumberOfInstances() |
long |
getQueueLength(int coreID) |
abstract double |
getRemainingDemandForProcess(SimuComSimProcess thread) |
String |
getResourceTypeId()
Returns the id of the resource type (e.g.
|
abstract IActiveResource |
getScheduledResource() |
String |
getSchedulingStrategyID() |
IActiveResource |
getUnderlyingResource()
Returns the underlying resource
|
boolean |
isAvailable()
Retrieves the current availability status of this resource.
|
boolean |
isRequiredByContainer()
Asks if a processing resource is required by its surrounding container.
|
void |
setAvailable(boolean isAvailable)
Marks the resource as being available or unavailable.
|
void |
update(long state,
int instanceId)
Notifies the sensor about a state change of the resource.
|
abstract void |
updateDemand(SimuComSimProcess thread,
double demand) |
getModel
getEncapsulatedEntity, isScheduled, reschedule
getName
public IActiveResource getUnderlyingResource()
public abstract void consumeResource(SimuComSimProcess thread, int resourceServiceID, Map<String,Serializable> parameterMap, double demand)
thread
- 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.demand
- The resource demand the client wishes to be processed by the resourcepublic abstract double getRemainingDemandForProcess(SimuComSimProcess thread)
public abstract void updateDemand(SimuComSimProcess thread, double demand)
public void activateResource()
public void deactivateResource()
IStateListener#stateChanged()
event.public abstract IActiveResource getScheduledResource()
public void setAvailable(boolean isAvailable)
isAvailable
- the target state to setpublic boolean isAvailable()
public boolean isRequiredByContainer()
public String getDescription()
public int getNumberOfInstances()
public void addStateListener(IStateListener listener, int instance)
public void addOverallUtilizationListener(IOverallUtilizationListener listener)
public void addDemandListener(IDemandListener listener)
public void update(long state, int instanceId)
IActiveResourceStateSensor
update
in interface IActiveResourceStateSensor
state
- the changed stateinstanceId
- id of the instance whose state changedpublic void demandCompleted(ISchedulableProcess simProcess)
IActiveResourceStateSensor
demandCompleted
in interface IActiveResourceStateSensor
simProcess
- the process whose demand has been completed by the resource.public String getResourceTypeId()
Be warned that this method's name may be confusing since it interprets the term "resource type id" different to the rest of SimuCom! In SimuCom, the variable name "typeID" is mostly used to refer to the name (!) of a resource type, i.e. "CPU", not "_oro4g...".
TODO: the typeID
variables should be renamed to typeName
or similar!
public String getSchedulingStrategyID()
public long getQueueLength(int coreID)