Class SimSimpleFairPassiveResource
- java.lang.Object
-
- de.uka.ipd.sdq.simulation.abstractsimengine.SimulationElement
-
- de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator
-
- de.uka.ipd.sdq.scheduler.entities.SchedulerEntity
-
- de.uka.ipd.sdq.scheduler.resources.AbstractSimResource
-
- de.uka.ipd.sdq.simucomframework.resources.SimSimpleFairPassiveResource
-
- Type Parameters:
M
- the type of the simulation model.
- All Implemented Interfaces:
de.uka.ipd.sdq.scheduler.IPassiveResource
,de.uka.ipd.sdq.simulation.abstractsimengine.IEntity
public class SimSimpleFairPassiveResource extends de.uka.ipd.sdq.scheduler.resources.AbstractSimResource implements de.uka.ipd.sdq.scheduler.IPassiveResource
Simulates a simple passive resource. Note: This class intentionally does not extendSimAbstractPassiveResource
, because that abstract class is intended for passive resources that are accessed by EXACT schedulers (e.g., specific Windows, Linux Scheduler). TODO: comment TODO Initialize based on given model elements [Lehrig]
-
-
Field Summary
Fields Modifier and Type Field Description protected Queue<de.uka.ipd.sdq.scheduler.processes.IWaitingProcess>
waitingQueue
-
Constructor Summary
Constructors Constructor Description SimSimpleFairPassiveResource(org.palladiosimulator.pcm.repository.PassiveResource resource, org.palladiosimulator.pcm.core.composition.AssemblyContext assemblyContext, de.uka.ipd.sdq.scheduler.SchedulerModel model, Long capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acquire(de.uka.ipd.sdq.scheduler.ISchedulableProcess schedulableProcess, long num, boolean timeout, double timeoutValue)
void
addObserver(de.uka.ipd.sdq.scheduler.sensors.IPassiveResourceSensor observer)
org.palladiosimulator.pcm.core.composition.AssemblyContext
getAssemblyContext()
long
getAvailable()
protected String
getPassiveResourceID()
Retrieves the passive resource ID.org.palladiosimulator.pcm.repository.PassiveResource
getResource()
Queue<de.uka.ipd.sdq.scheduler.processes.IWaitingProcess>
getWaitingProcesses()
boolean
isWaiting(de.uka.ipd.sdq.scheduler.processes.SimpleWaitingProcess process)
Determines if a given process is currently waiting to acquire this resource.void
release(de.uka.ipd.sdq.scheduler.ISchedulableProcess schedulableProcess, long num)
void
remove(de.uka.ipd.sdq.scheduler.processes.SimpleWaitingProcess process)
Removes a waiting process from the queue.void
removeObserver(de.uka.ipd.sdq.scheduler.sensors.IPassiveResourceSensor observer)
-
Methods inherited from class de.uka.ipd.sdq.scheduler.resources.AbstractSimResource
equals, getCapacity, getId, getName, hashCode, toString
-
Methods inherited from class de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator
getEncapsulatedEntity, isScheduled, reschedule
-
-
-
-
Field Detail
-
waitingQueue
protected Queue<de.uka.ipd.sdq.scheduler.processes.IWaitingProcess> waitingQueue
-
-
Constructor Detail
-
SimSimpleFairPassiveResource
public SimSimpleFairPassiveResource(org.palladiosimulator.pcm.repository.PassiveResource resource, org.palladiosimulator.pcm.core.composition.AssemblyContext assemblyContext, de.uka.ipd.sdq.scheduler.SchedulerModel model, Long capacity)
-
-
Method Detail
-
getResource
public org.palladiosimulator.pcm.repository.PassiveResource getResource()
- Specified by:
getResource
in interfacede.uka.ipd.sdq.scheduler.IPassiveResource
-
getAssemblyContext
public org.palladiosimulator.pcm.core.composition.AssemblyContext getAssemblyContext()
- Specified by:
getAssemblyContext
in interfacede.uka.ipd.sdq.scheduler.IPassiveResource
-
getWaitingProcesses
public Queue<de.uka.ipd.sdq.scheduler.processes.IWaitingProcess> getWaitingProcesses()
- Specified by:
getWaitingProcesses
in interfacede.uka.ipd.sdq.scheduler.IPassiveResource
-
acquire
public boolean acquire(de.uka.ipd.sdq.scheduler.ISchedulableProcess schedulableProcess, long num, boolean timeout, double timeoutValue)
- Specified by:
acquire
in interfacede.uka.ipd.sdq.scheduler.IPassiveResource
-
getPassiveResourceID
protected String getPassiveResourceID()
Retrieves the passive resource ID.- Returns:
- the passive resource ID
-
release
public void release(de.uka.ipd.sdq.scheduler.ISchedulableProcess schedulableProcess, long num)
- Specified by:
release
in interfacede.uka.ipd.sdq.scheduler.IPassiveResource
-
addObserver
public void addObserver(de.uka.ipd.sdq.scheduler.sensors.IPassiveResourceSensor observer)
- Specified by:
addObserver
in interfacede.uka.ipd.sdq.scheduler.IPassiveResource
-
removeObserver
public void removeObserver(de.uka.ipd.sdq.scheduler.sensors.IPassiveResourceSensor observer)
- Specified by:
removeObserver
in interfacede.uka.ipd.sdq.scheduler.IPassiveResource
-
getAvailable
public long getAvailable()
- Specified by:
getAvailable
in interfacede.uka.ipd.sdq.scheduler.IPassiveResource
-
isWaiting
public boolean isWaiting(de.uka.ipd.sdq.scheduler.processes.SimpleWaitingProcess process)
Determines if a given process is currently waiting to acquire this resource.- Parameters:
process
- the process- Returns:
- TRUE if the process is waiting to acquire the resource; FALSE otherwise
-
remove
public void remove(de.uka.ipd.sdq.scheduler.processes.SimpleWaitingProcess process)
Removes a waiting process from the queue.- Parameters:
process
- the process to remove
-
-