org.ow2.clif.probe.util
Class AbstractDumbInsert

java.lang.Object
  extended by org.ow2.clif.probe.util.AbstractDumbInsert
All Implemented Interfaces:
java.lang.Runnable, org.objectweb.fractal.api.control.BindingController, org.objectweb.fractal.api.control.LifeCycleController, 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, org.objectweb.fractal.api.control.LifeCycleController, 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
protected  java.lang.Object activity_lock
           
protected  long arg_duration_ms
           
protected  long arg_period_ms
           
protected  java.util.ArrayList arg_probe_config
           
protected  long baseTime_ms
           
protected  BladeInsertResponse bir
           
protected  java.lang.Object dc_lock
           
protected  DataCollectorWrite dcw
           
protected  java.util.Map eventStorageStatesMap
           
protected  java.lang.Thread poller
           
protected  java.lang.String probeId
           
protected  java.lang.Object sr_lock
           
protected  boolean started
           
protected  boolean stopped
           
protected  BooleanHolder storeAlarmEvents
           
protected  BooleanHolder storeLifeCycleEvents
           
protected  BooleanHolder storeProbeEvents
           
protected  boolean suspended
           
protected  boolean terminated
           
 
Fields inherited from interface org.ow2.clif.server.api.BladeControl
BLADE_CONTROL, BLADE_INSERT_CONTROL
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
AbstractDumbInsert()
           
 
Method Summary
 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.
protected  void close()
          Override this method when you are willing to release some resources when the probe ends its activity.
protected  void configProbewithArray()
          Override this method when you are willing to pass some parameters to the Insert.
protected abstract  ProbeEvent doProbe()
          Override this method to perform your measure and return it
 java.util.Map getCurrentParameters()
          Returns a Map which maps the defined parameters to their values.
 java.lang.String getFcState()
           
 java.lang.String getId()
           
 void init(java.io.Serializable testId)
          Initialize the activity
 void join()
          Waits until the end of the activity
 java.lang.String[] listFc()
           
 java.lang.Object lookupFc(java.lang.String clientItfName)
           
 void resume()
          Resume the activity (if suspended)
 void run()
           
 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()
          Initial start of the activity
 void startFc()
           
 void stop()
          Final stop of the activity
 void stopFc()
           
 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

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

arg_probe_config

protected java.util.ArrayList arg_probe_config

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 eventStorageStatesMap
Constructor Detail

AbstractDumbInsert

public AbstractDumbInsert()
Method Detail

doProbe

protected abstract ProbeEvent doProbe()
Override this method to perform your measure and return it

Returns:
an probe event holding the measure

configProbewithArray

protected void configProbewithArray()
                             throws ClifException
Override this method when you are willing to pass some parameters to the Insert. Parameters may be an xml config file, the specification of a disk name or a network interface. The parameters have to be entered on the BladeArgument section of the clif gui after the arg_period_ms and arg_duration_ms parameters.

Throws:
ClifException

close

protected void close()
              throws ClifException
Override this method when you are willing to release some resources when the probe ends its activity.

Throws:
ClifException

startFc

public void startFc()
Specified by:
startFc in interface org.objectweb.fractal.api.control.LifeCycleController

stopFc

public void stopFc()
Specified by:
stopFc in interface org.objectweb.fractal.api.control.LifeCycleController

getFcState

public java.lang.String getFcState()
Specified by:
getFcState in interface org.objectweb.fractal.api.control.LifeCycleController

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)
Description copied from interface: ActivityControl
Initialize the activity

Specified by:
init in interface ActivityControl
Parameters:
testId - unique identifier of the new test

start

public void start()
Description copied from interface: ActivityControl
Initial start of the activity

Specified by:
start in interface ActivityControl

stop

public void stop()
Description copied from interface: ActivityControl
Final stop of the activity

Specified by:
stop in interface ActivityControl

suspend

public void suspend()
Description copied from interface: ActivityControl
Suspend the activity

Specified by:
suspend in interface ActivityControl

resume

public void resume()
Description copied from interface: ActivityControl
Resume the activity (if suspended)

Specified by:
resume in interface ActivityControl

join

public void join()
Description copied from interface: ActivityControl
Waits until the end of the activity

Specified by:
join in interface ActivityControl

setArgument

public void setArgument(java.lang.String arg)
                 throws ClifException
Sets number of threads and test duration parameters

Specified by:
setArgument in interface BladeControl
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:
setId in interface BladeControl

getId

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

run

public void run()
Specified by:
run in interface java.lang.Runnable

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