Class SimPassiveResource
- java.lang.Object
-
- de.uka.ipd.sdq.simulation.abstractsimengine.SimulationElement
-
- de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator
-
- edu.kit.ipd.sdq.eventsim.entities.EventSimEntity
-
- edu.kit.ipd.sdq.eventsim.resources.entities.SimPassiveResource
-
- All Implemented Interfaces:
de.uka.ipd.sdq.simulation.abstractsimengine.IEntity
public class SimPassiveResource extends EventSimEntity
A passive resource is a resource that can be acquired by a simulated process, then be hold for a certain amount of time and is finally released by the process. It has a limited capacity which decreases whenever a process acquires the resource. Conversely, the available capacity increases when a process releases the resource.If a process tries to acquire a resource with no free capacity, the resource gets passivated until the passive resource can serve the acquisition.
- See Also:
IPassiveResource
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class edu.kit.ipd.sdq.eventsim.entities.EventSimEntity
EventSimEntity.EntityLifecyclePhase
-
-
Constructor Summary
Constructors Constructor Description SimPassiveResource(de.uka.ipd.sdq.simulation.abstractsimengine.ISimulationModel model, de.uka.ipd.sdq.scheduler.IPassiveResource resource, org.palladiosimulator.pcm.repository.PassiveResource specification)
Construct a passive resource that wraps the specified resource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acquire(SimulatedProcess process, int num, boolean timeout, double timeoutValue, Procedure onGrantedCallback)
Acquires the specified number of instances for the given process.void
addListener(IPassiveResourceListener l)
protected void
fireAcquire(SimulatedProcess process, long num)
protected void
fireRelease(SimulatedProcess process, long num)
protected void
fireRequest(SimulatedProcess process, long num)
org.palladiosimulator.pcm.core.composition.AssemblyContext
getAssemblyContext()
long
getAvailable()
Returns the number of remaining instances.long
getCapacity()
Returns the maximal number of instances that can be hold at the same time.String
getId()
Returns the unique identifier of this resource.String
getName()
Returns the name of this resouceorg.palladiosimulator.pcm.repository.PassiveResource
getSpecification()
void
release(SimulatedProcess process, int num)
Releases the specified number of instances.void
removeListener(IPassiveResourceListener l)
-
Methods inherited from class edu.kit.ipd.sdq.eventsim.entities.EventSimEntity
addEntityListener, equals, getEntityId, getLifecyclePhase, hashCode, notifyEnteredSystem, notifyLeftSystem, removeEntityListener, resetIdGenerator, toString
-
-
-
-
Constructor Detail
-
SimPassiveResource
@Inject public SimPassiveResource(de.uka.ipd.sdq.simulation.abstractsimengine.ISimulationModel model, de.uka.ipd.sdq.scheduler.IPassiveResource resource, org.palladiosimulator.pcm.repository.PassiveResource specification)
Construct a passive resource that wraps the specified resource.- Parameters:
model
- the simulation modelresource
- the wrapped scheduler resourcespecification
- the specification of this resource
-
-
Method Detail
-
acquire
public void acquire(SimulatedProcess process, int num, boolean timeout, double timeoutValue, Procedure onGrantedCallback)
Acquires the specified number of instances for the given process. If not enough instances are available, the process is passivated until the instances become available.- See Also:
IPassiveResource#acquire(de.uka.ipd.sdq.scheduler.ISchedulableProcess, int)
-
release
public void release(SimulatedProcess process, int num)
Releases the specified number of instances.- See Also:
IPassiveResource#release(de.uka.ipd.sdq.scheduler.ISchedulableProcess, int)
-
getAvailable
public long getAvailable()
Returns the number of remaining instances.
-
getCapacity
public long getCapacity()
Returns the maximal number of instances that can be hold at the same time.
-
getId
public String getId()
Returns the unique identifier of this resource.- Returns:
- the unique identifier
-
getName
public String getName()
Returns the name of this resouce- Overrides:
getName
in classEventSimEntity
- Returns:
- the resource's name
-
getAssemblyContext
public org.palladiosimulator.pcm.core.composition.AssemblyContext getAssemblyContext()
-
getSpecification
public org.palladiosimulator.pcm.repository.PassiveResource getSpecification()
-
addListener
public void addListener(IPassiveResourceListener l)
-
removeListener
public void removeListener(IPassiveResourceListener l)
-
fireRequest
protected void fireRequest(SimulatedProcess process, long num)
-
fireAcquire
protected void fireAcquire(SimulatedProcess process, long num)
-
fireRelease
protected void fireRelease(SimulatedProcess process, long num)
-
-