Class 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 extend 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]
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Queue<de.uka.ipd.sdq.scheduler.processes.IWaitingProcess> waitingQueue  
      • Fields inherited from class de.uka.ipd.sdq.scheduler.resources.AbstractSimResource

        capacity
      • Fields inherited from class de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator

        delegate
      • Fields inherited from interface de.uka.ipd.sdq.simulation.abstractsimengine.IEntity

        NULL
    • 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.scheduler.entities.SchedulerEntity

        getModel
      • Methods inherited from class de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator

        getEncapsulatedEntity, isScheduled, reschedule
      • Methods inherited from interface de.uka.ipd.sdq.scheduler.IPassiveResource

        getCapacity, getId, getName
    • 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 interface de.uka.ipd.sdq.scheduler.IPassiveResource
      • getAssemblyContext

        public org.palladiosimulator.pcm.core.composition.AssemblyContext getAssemblyContext()
        Specified by:
        getAssemblyContext in interface de.uka.ipd.sdq.scheduler.IPassiveResource
      • getWaitingProcesses

        public Queue<de.uka.ipd.sdq.scheduler.processes.IWaitingProcess> getWaitingProcesses()
        Specified by:
        getWaitingProcesses in interface de.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 interface de.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 interface de.uka.ipd.sdq.scheduler.IPassiveResource
      • addObserver

        public void addObserver​(de.uka.ipd.sdq.scheduler.sensors.IPassiveResourceSensor observer)
        Specified by:
        addObserver in interface de.uka.ipd.sdq.scheduler.IPassiveResource
      • removeObserver

        public void removeObserver​(de.uka.ipd.sdq.scheduler.sensors.IPassiveResourceSensor observer)
        Specified by:
        removeObserver in interface de.uka.ipd.sdq.scheduler.IPassiveResource
      • getAvailable

        public long getAvailable()
        Specified by:
        getAvailable in interface de.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