Class 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
    • 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 model
        resource - the wrapped scheduler resource
        specification - 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 class EventSimEntity
        Returns:
        the resource's name
      • getAssemblyContext

        public org.palladiosimulator.pcm.core.composition.AssemblyContext getAssemblyContext()
      • getSpecification

        public org.palladiosimulator.pcm.repository.PassiveResource getSpecification()
      • fireRequest

        protected void fireRequest​(SimulatedProcess process,
                                   long num)
      • fireAcquire

        protected void fireAcquire​(SimulatedProcess process,
                                   long num)
      • fireRelease

        protected void fireRelease​(SimulatedProcess process,
                                   long num)