Class AbstractActiveResource

    • Field Detail

      • schedulerResource

        protected final de.uka.ipd.sdq.scheduler.IActiveResource schedulerResource
        the encapsulated scheduler resource
    • Constructor Detail

      • AbstractActiveResource

        public AbstractActiveResource​(de.uka.ipd.sdq.simulation.abstractsimengine.ISimulationModel simulationModel,
                                      String namePrefix,
                                      de.uka.ipd.sdq.scheduler.IActiveResource schedulerResource,
                                      org.palladiosimulator.pcm.resourcetype.SchedulingPolicy schedulingStrategy,
                                      int numberOfInstances)
    • Method Detail

      • setupStateListenerAdapter

        protected void setupStateListenerAdapter​(de.uka.ipd.sdq.scheduler.IActiveResource resource)
        Translates the IActiveResourceStateSensor listener to the IStateListener. As a result, all IStateListener of this resource get notified if the encapsulated scheduler resource fires a IActiveResourceStateSensor event.
      • consumeResource

        public void consumeResource​(SimulatedProcess process,
                                    double abstractDemand,
                                    int resourceServiceID,
                                    Procedure onServedCallback)
        Processes the specified demand issued by the given process.
        Parameters:
        process - the process that has requested the demand
        abstractDemand - the demand
        resourceServiceID - the resource service ID
        onServedCallback - called when the requested demand has been served
      • calculateConcreteDemand

        protected abstract double calculateConcreteDemand​(double abstractDemand,
                                                          int resourceServiceId)
      • getNumberOfInstances

        public int getNumberOfInstances()
        Returns:
        the number of instances (e.g., cores in case of a processor) that constitute this resource.
      • getQueueLength

        public long getQueueLength​(int instanceId)
        Returns:
        the number of jobs in the resource's queue waiting to be processed. TODO: check, if this value is rather the queue length plus (!) the number of jobs being processed at the moment.
      • getSchedulingStrategy

        public org.palladiosimulator.pcm.resourcetype.SchedulingPolicy getSchedulingStrategy()
      • addDemandListener

        public void addDemandListener​(IDemandListener listener)
      • addStateListener

        public void addStateListener​(IStateListener listener,
                                     int instance)
      • fireDemand

        protected void fireDemand​(de.uka.ipd.sdq.scheduler.ISchedulableProcess process,
                                  double demand,
                                  int resourceServiceID)
        Notifies the demand listeners that the specified demand has been requested.
        Parameters:
        process - the requesting process
        demand - the requested demand
        resourceServiceID - the resource service id
      • fireStateEvent

        protected void fireStateEvent​(long state,
                                      int instance)
        Notifies the state listeners that the state of the specified instance has changed.
        Parameters:
        state - the resource's queue length
        instance - the affected resource instance
      • deactivateResource

        public void deactivateResource()
        Called to notify this resource that the simulation run has stopped.