Class ActivityDef

java.lang.Object
io.nosqlbench.nb.api.engine.activityimpl.ActivityDef
All Implemented Interfaces:
NBNamedElement

public class ActivityDef extends Object implements NBNamedElement

A runtime definition for an activity.

Instances of ActivityDef hold control values for the execution of a single activity. Each thread of the related activity is initialized with the associated ActivityDef. When the ActivityDef is modified, interested activity threads are notified so that they can dynamically adjust.

The canonical values for all parameters are kept internally in the parameter map. Essentially, ActivityDef is just a type-aware wrapper around a thread-safe parameter map, with an atomic change counter which can be used to signal changes to observers.

  • Field Details

  • Constructor Details

    • ActivityDef

      public ActivityDef(ParameterMap parameterMap)
  • Method Details

    • parseActivityDef

      public static ActivityDef parseActivityDef(String namedActivitySpec)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getAlias

      public String getAlias()
      The alias that the associated activity instance is known by.
      Returns:
      the alias
    • getActivityDriver

      public String getActivityDriver()
      Return tbe Activity Driver Adapter Name
      Returns:
      the driver adapter name
    • getStartCycle

      public long getStartCycle()
      The first cycle that will be used for execution of this activity, inclusive. If the value is provided as a range as in 0..10, then the first number is the start cycle and the second number is the end cycle +1. Effectively, cycle ranges are [closed,open) intervals, as in [min..max)
      Returns:
      the long start cycle
    • setStartCycle

      public void setStartCycle(long firstCycleInclusive)
    • setStartCycle

      public void setStartCycle(String firstCycleInclusive)
    • setEndCycle

      public void setEndCycle(long lastCycleExclusive)
    • setEndCycle

      public void setEndCycle(String lastCycleExclusive)
    • getEndCycle

      public long getEndCycle()
      The last cycle that will be used for execution of this activity, inclusive.
      Returns:
      the long end cycle
    • getThreads

      public int getThreads()
      The number of threads (AKA slots) that the associated activity should currently be using.
      Returns:
      target thread count
    • setThreads

      public void setThreads(int threads)
    • getParams

      public ParameterMap getParams()
      Get the parameter map, which is the backing-store for all data within an ActivityDef.
      Returns:
      the parameter map
    • getChangeCounter

      public AtomicLong getChangeCounter()
    • setCycles

      public void setCycles(String cycles)
    • getCycleSummary

      public String getCycleSummary()
    • getCycleCount

      public long getCycleCount()
    • getCyclesSpec

      public CyclesSpec getCyclesSpec()
    • getRecyclesSpec

      public CyclesSpec getRecyclesSpec()
    • getName

      public String getName()
      Specified by:
      getName in interface NBNamedElement
    • deprecate

      public ActivityDef deprecate(String deprecatedName, String newName)
    • auxLabels

      public NBLabels auxLabels()
    • getConfigModel

      public NBConfigModel getConfigModel()