Class SimPassiveResource

  • All Implemented Interfaces:

    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:
    • Constructor Detail

      • SimPassiveResource

        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.
        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.
        the unique identifier
      • getName

        public String getName()
        Returns the name of this resouce
        getName in class EventSimEntity
        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)