Package org.ow2.clif.probe.util
Class AbstractDumbInsert
- java.lang.Object
-
- org.ow2.clif.probe.util.AbstractDumbInsert
-
- All Implemented Interfaces:
java.lang.Runnable,org.objectweb.fractal.api.control.BindingController,ActivityControl,BladeControl
- Direct Known Subclasses:
AbstractInsert,Insert,Insert,Insert,Insert,Insert,Insert,Insert,Insert_JRockit5
public abstract class AbstractDumbInsert extends java.lang.Object implements BladeControl, org.objectweb.fractal.api.control.BindingController, java.lang.Runnable
This abstract implementation of a blade insert component manages a single thread, doing a periodic task (probing) with a given period (in milliseconds) and during an given actual time. It provides a "dumb" interpretation of the blade lifecycle with regard to the ActivityControl interface, inasmuch as it actually probes from its initialization time to its stop time, regardless of start(), suspend() and resume() orders.- Author:
- Bruno Dillenseger, Emmanuel Varoquaux
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Objectactivity_lockprotected longarg_duration_msprotected longarg_period_msprotected longbaseTime_msprotected BladeInsertResponsebirprotected java.lang.Objectdc_lockprotected DataCollectorWritedcwprotected java.util.Map<java.lang.String,java.lang.Object>eventStorageStatesMapprotected java.lang.Threadpollerprotected java.lang.StringprobeIdprotected java.lang.Objectsr_lockprotected booleanstartedprotected booleanstoppedprotected BooleanHolderstoreAlarmEventsprotected BooleanHolderstoreLifeCycleEventsprotected BooleanHolderstoreProbeEventsprotected booleansuspendedprotected booleanterminated-
Fields inherited from interface org.ow2.clif.server.api.BladeControl
BLADE_CONTROL, BLADE_INSERT_CONTROL
-
-
Constructor Summary
Constructors Constructor Description AbstractDumbInsert()
-
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.protected voidclose()Override this method when you are willing to release some resources when the probe ends its activity.protected abstract ProbeEventdoProbe()Define this method to perform your measure and return itjava.util.Map<java.lang.String,java.io.Serializable>getCurrentParameters()Returns aMapwhich maps the defined parameters to their values.java.lang.StringgetHelpMessage()Gives probe help.java.lang.StringgetId()voidinit(java.io.Serializable testId)Initialize the activityvoidjoin()Waits until the end of the activityjava.lang.String[]listFc()java.lang.ObjectlookupFc(java.lang.String clientItfName)voidresume()Resume the activity (if suspended)voidrun()voidsetArgument(java.lang.String arg)Sets sampling period duration parameters.protected voidsetExtraArguments(java.util.List<java.lang.String> extraArgs)Override this method when you are willing to pass some extra parameters to the Insert, below the sampling period and duration standard arguments.voidsetId(java.lang.String id)Sets this scenario's unique identifiervoidstart()Initial start of the activityvoidstop()Final stop of the activityvoidsuspend()Suspend the activityvoidunbindFc(java.lang.String clientItfName)
-
-
-
Field Detail
-
probeId
protected java.lang.String probeId
-
activity_lock
protected java.lang.Object activity_lock
-
bir
protected BladeInsertResponse bir
-
sr_lock
protected java.lang.Object sr_lock
-
dcw
protected DataCollectorWrite dcw
-
dc_lock
protected java.lang.Object dc_lock
-
arg_period_ms
protected long arg_period_ms
-
arg_duration_ms
protected long arg_duration_ms
-
baseTime_ms
protected long baseTime_ms
-
started
protected volatile boolean started
-
stopped
protected volatile boolean stopped
-
suspended
protected volatile boolean suspended
-
terminated
protected volatile boolean terminated
-
poller
protected java.lang.Thread poller
-
storeLifeCycleEvents
protected final BooleanHolder storeLifeCycleEvents
-
storeAlarmEvents
protected final BooleanHolder storeAlarmEvents
-
storeProbeEvents
protected final BooleanHolder storeProbeEvents
-
eventStorageStatesMap
protected final java.util.Map<java.lang.String,java.lang.Object> eventStorageStatesMap
-
-
Method Detail
-
doProbe
protected abstract ProbeEvent doProbe()
Define this method to perform your measure and return it- Returns:
- an probe event holding the measure
-
getHelpMessage
public java.lang.String getHelpMessage()
Gives probe help. This basic implementation mentions the 2 first arguments: polling period and execution time. Override this method to extend the help message by adding extra arguments when necessary.- Returns:
- a message giving basic help to use this probe
-
setExtraArguments
protected void setExtraArguments(java.util.List<java.lang.String> extraArgs) throws ClifExceptionOverride this method when you are willing to pass some extra parameters to the Insert, below the sampling period and duration standard arguments.- Throws:
ClifException
-
close
protected void close() throws ClifExceptionOverride this method when you are willing to release some resources when the probe ends its activity.- 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)
Description copied from interface:ActivityControlInitialize the activity- Specified by:
initin interfaceActivityControl- Parameters:
testId- unique identifier of the new test
-
start
public void start()
Description copied from interface:ActivityControlInitial start of the activity- 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) throws ClifExceptionSets sampling period duration parameters. Possible extra arguments are passed through- Specified by:
setArgumentin interfaceBladeControl- Parameters:
arg- should hold 2 integer parameters (separated with usual separators) setting (1) the observation polling period in ms, and (2) the test duration in seconds.- Throws:
ClifException
-
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
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
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<java.lang.String,java.io.Serializable> getCurrentParameters()
Description copied from interface:BladeControlReturns aMapwhich maps the defined parameters to their values.- Specified by:
getCurrentParametersin interfaceBladeControl
-
-