Class MTScenario

  • All Implemented Interfaces:
    org.objectweb.fractal.api.control.BindingController, ActivityControl, BladeControl

    public abstract class MTScenario
    extends java.lang.Object
    implements BladeControl, org.objectweb.fractal.api.control.BindingController
    Abstract implementation of a multi-thread based scenario component. Method newSession() should be implemented by a derived class in order to provide actual action to be performed. Each session loops on calling its action() method, animated by its own thread. MTscenario must be given an argument line (as a single String) beginning with 3 integer parameters:
    • the number of threads
    • the loop time-out in seconds
    • the ramp-up time in seconds (added to the loop time-out)
    The trailing characters of the argument String is passed as argument to the newSession() method.
    Author:
    Bruno Dillenseger
    See Also:
    newSession(int, String), setArgument(String)
    • Constructor Summary

      Constructors 
      Constructor Description
      MTScenario()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void bindFc​(java.lang.String clientItfName, java.lang.Object serverItf)  
      void changeParameter​(java.lang.String parameter, java.io.Serializable value)
      Sets the parameter parameter of this blade with the value value.
      java.util.Map getCurrentParameters()
      Returns a Map which maps the defined parameters to their values.
      java.lang.String getId()  
      void init​(java.io.Serializable testId)
      initializes a new test, creating and starting the given number of activity threads, and returns as soon as every thread has been actually started
      void join()
      Waits until the end of the activity
      java.lang.String[] listFc()  
      java.lang.Object lookupFc​(java.lang.String clientItfName)  
      abstract MTScenarioSession newSession​(int sessionId, java.lang.String arg)  
      void resume()
      Resume the activity (if suspended)
      void setArgument​(java.lang.String arg)
      Sets number of threads and test duration parameters
      void setId​(java.lang.String id)
      Sets this scenario's unique identifier
      void start()
      releases every activity thread
      void stop()
      Final stop of the activity
      void suspend()
      Suspend the activity
      void unbindFc​(java.lang.String clientItfName)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • testId

        protected java.io.Serializable testId
      • scenarioId

        protected java.lang.String scenarioId
    • Constructor Detail

      • MTScenario

        public MTScenario()
    • Method Detail

      • lookupFc

        public java.lang.Object lookupFc​(java.lang.String clientItfName)
        Specified by:
        lookupFc in interface org.objectweb.fractal.api.control.BindingController
      • bindFc

        public void bindFc​(java.lang.String clientItfName,
                           java.lang.Object serverItf)
        Specified by:
        bindFc in interface org.objectweb.fractal.api.control.BindingController
      • unbindFc

        public void unbindFc​(java.lang.String clientItfName)
        Specified by:
        unbindFc in interface org.objectweb.fractal.api.control.BindingController
      • listFc

        public java.lang.String[] listFc()
        Specified by:
        listFc in interface org.objectweb.fractal.api.control.BindingController
      • init

        public void init​(java.io.Serializable testId)
                  throws ClifException
        initializes a new test, creating and starting the given number of activity threads, and returns as soon as every thread has been actually started
        Specified by:
        init in interface ActivityControl
        Parameters:
        testId - unique identifier of the new test
        Throws:
        ClifException
      • start

        public void start()
        releases every activity thread
        Specified by:
        start in interface ActivityControl
      • setArgument

        public void setArgument​(java.lang.String arg)
        Sets number of threads and test duration parameters
        Specified by:
        setArgument in interface BladeControl
        Parameters:
        arg - should begin with 2 integer parameters (separated with usual separators) setting (1) the number of threads and (2) the test duration (in seconds). The trailing String will be used as an argument when creating sessions.
        See Also:
        newSession(int, String)
      • setId

        public void setId​(java.lang.String id)
        Sets this scenario's unique identifier
        Specified by:
        setId in interface BladeControl
      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface BladeControl
        Returns:
        the scenario/blade identifier
      • changeParameter

        public void changeParameter​(java.lang.String parameter,
                                    java.io.Serializable value)
                             throws ClifException
        Description copied from interface: BladeControl
        Sets the parameter parameter of this blade with the value value. This method allows to change parameters independently of the activity of the blade. However, some parameters can depend on the state of the blade.
        Specified by:
        changeParameter in interface BladeControl
        Throws:
        ClifException
      • getCurrentParameters

        public java.util.Map getCurrentParameters()
        Description copied from interface: BladeControl
        Returns a Map which maps the defined parameters to their values.
        Specified by:
        getCurrentParameters in interface BladeControl