Class MTScenario
- java.lang.Object
-
- org.ow2.clif.scenario.multithread.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)
- Author:
- Bruno Dillenseger
- See Also:
newSession(int, String),setArgument(String)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringscenarioIdprotected java.io.SerializabletestId-
Fields inherited from interface org.ow2.clif.server.api.BladeControl
BLADE_CONTROL, BLADE_INSERT_CONTROL
-
-
Constructor Summary
Constructors Constructor Description MTScenario()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidbindFc(java.lang.String clientItfName, java.lang.Object serverItf)voidchangeParameter(java.lang.String parameter, java.io.Serializable value)Sets the parameterparameterof this blade with the valuevalue.java.util.MapgetCurrentParameters()Returns aMapwhich maps the defined parameters to their values.java.lang.StringgetId()voidinit(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 startedvoidjoin()Waits until the end of the activityjava.lang.String[]listFc()java.lang.ObjectlookupFc(java.lang.String clientItfName)abstract MTScenarioSessionnewSession(int sessionId, java.lang.String arg)voidresume()Resume the activity (if suspended)voidsetArgument(java.lang.String arg)Sets number of threads and test duration parametersvoidsetId(java.lang.String id)Sets this scenario's unique identifiervoidstart()releases every activity threadvoidstop()Final stop of the activityvoidsuspend()Suspend the activityvoidunbindFc(java.lang.String clientItfName)
-
-
-
Method Detail
-
newSession
public abstract MTScenarioSession newSession(int sessionId, java.lang.String arg) throws ClifException
- Throws:
ClifException
-
lookupFc
public java.lang.Object lookupFc(java.lang.String clientItfName)
- Specified by:
lookupFcin interfaceorg.objectweb.fractal.api.control.BindingController
-
bindFc
public void bindFc(java.lang.String clientItfName, java.lang.Object serverItf)- Specified by:
bindFcin interfaceorg.objectweb.fractal.api.control.BindingController
-
unbindFc
public void unbindFc(java.lang.String clientItfName)
- Specified by:
unbindFcin interfaceorg.objectweb.fractal.api.control.BindingController
-
listFc
public java.lang.String[] listFc()
- Specified by:
listFcin interfaceorg.objectweb.fractal.api.control.BindingController
-
init
public void init(java.io.Serializable testId) throws ClifExceptioninitializes 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:
initin interfaceActivityControl- Parameters:
testId- unique identifier of the new test- Throws:
ClifException
-
start
public void start()
releases every activity thread- Specified by:
startin interfaceActivityControl
-
stop
public void stop()
Description copied from interface:ActivityControlFinal stop of the activity- Specified by:
stopin interfaceActivityControl
-
suspend
public void suspend()
Description copied from interface:ActivityControlSuspend the activity- Specified by:
suspendin interfaceActivityControl
-
resume
public void resume()
Description copied from interface:ActivityControlResume the activity (if suspended)- Specified by:
resumein interfaceActivityControl
-
join
public void join()
Description copied from interface:ActivityControlWaits until the end of the activity- Specified by:
joinin interfaceActivityControl
-
setArgument
public void setArgument(java.lang.String arg)
Sets number of threads and test duration parameters- Specified by:
setArgumentin interfaceBladeControl- 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:
setIdin interfaceBladeControl
-
getId
public java.lang.String getId()
- Specified by:
getIdin interfaceBladeControl- Returns:
- the scenario/blade identifier
-
changeParameter
public void changeParameter(java.lang.String parameter, java.io.Serializable value) throws ClifExceptionDescription copied from interface:BladeControlSets the parameterparameterof this blade with the valuevalue. 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:
changeParameterin interfaceBladeControl- Throws:
ClifException
-
getCurrentParameters
public java.util.Map getCurrentParameters()
Description copied from interface:BladeControlReturns aMapwhich maps the defined parameters to their values.- Specified by:
getCurrentParametersin interfaceBladeControl
-
-