M
- the type of the simulation model.public class SimSimpleFairPassiveResource extends AbstractSimResource implements IPassiveResource
SimAbstractPassiveResource
, 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]Constructor and Description |
---|
SimSimpleFairPassiveResource(org.palladiosimulator.pcm.repository.PassiveResource resource,
org.palladiosimulator.pcm.core.composition.AssemblyContext assemblyContext,
SchedulerModel model,
Long capacity) |
Modifier and Type | Method and Description |
---|---|
boolean |
acquire(ISchedulableProcess schedulableProcess,
long num,
boolean timeout,
double timeoutValue)
Acquires num instances of the passive resource for the given process.
|
void |
addObserver(IPassiveResourceSensor observer)
Adds the given observer.
|
org.palladiosimulator.pcm.core.composition.AssemblyContext |
getAssemblyContext()
Getter for the model element of the assembly context.
|
long |
getAvailable()
Returns the number of remaining instances.
|
org.palladiosimulator.pcm.repository.PassiveResource |
getResource()
Getter for the model element of the passive resource.
|
Queue<IWaitingProcess> |
getWaitingProcesses()
Returns a queue containing the waiting processes for the passive resource.
|
boolean |
isWaiting(SimpleWaitingProcess process)
Determines if a given process is currently waiting to acquire this resource.
|
void |
release(ISchedulableProcess schedulableProcess,
long num)
Releases num instances of the passive resource from the given process.
|
void |
remove(SimpleWaitingProcess process)
Removes a waiting process from the queue.
|
void |
removeObserver(IPassiveResourceSensor observer)
Removes the given observer
|
equals, getCapacity, getId, getName, hashCode, toString
getModel
getEncapsulatedEntity, isScheduled, reschedule
getCapacity, getId, getName
public SimSimpleFairPassiveResource(org.palladiosimulator.pcm.repository.PassiveResource resource, org.palladiosimulator.pcm.core.composition.AssemblyContext assemblyContext, SchedulerModel model, Long capacity)
public org.palladiosimulator.pcm.repository.PassiveResource getResource()
IPassiveResource
getResource
in interface IPassiveResource
public org.palladiosimulator.pcm.core.composition.AssemblyContext getAssemblyContext()
IPassiveResource
getAssemblyContext
in interface IPassiveResource
public Queue<IWaitingProcess> getWaitingProcesses()
IPassiveResource
getWaitingProcesses
in interface IPassiveResource
public boolean acquire(ISchedulableProcess schedulableProcess, long num, boolean timeout, double timeoutValue)
IPassiveResource
acquire
in interface IPassiveResource
public void release(ISchedulableProcess schedulableProcess, long num)
IPassiveResource
release
in interface IPassiveResource
public void addObserver(IPassiveResourceSensor observer)
IPassiveResource
addObserver
in interface IPassiveResource
public void removeObserver(IPassiveResourceSensor observer)
IPassiveResource
removeObserver
in interface IPassiveResource
public long getAvailable()
IPassiveResource
getAvailable
in interface IPassiveResource
public boolean isWaiting(SimpleWaitingProcess process)
process
- the processpublic void remove(SimpleWaitingProcess process)
process
- the process to remove