use of io.nosqlbench.engine.api.activityimpl.ActivityDef in project nosqlbench by nosqlbench.
the class ExceptionCountMetrics method count.
public void count(String name) {
Counter c = counters.get(name);
if (c == null) {
synchronized (counters) {
c = counters.computeIfAbsent(name, k -> ActivityMetrics.counter(activityDef, "errorcounts." + name));
}
}
c.inc();
}
use of io.nosqlbench.engine.api.activityimpl.ActivityDef in project nosqlbench by nosqlbench.
the class ExceptionTimerMetrics method update.
public void update(String name, long nanosDuration) {
Timer timer = timers.get(name);
if (timer == null) {
synchronized (timers) {
timer = timers.computeIfAbsent(name, k -> ActivityMetrics.timer(activityDef, "exceptions." + name));
}
}
timer.update(nanosDuration, TimeUnit.NANOSECONDS);
}
use of io.nosqlbench.engine.api.activityimpl.ActivityDef in project nosqlbench by nosqlbench.
the class ActivityExecutorTest method getActivityMotorFactory.
private MotorDispenser<?> getActivityMotorFactory(final ActivityDef ad, Action lc, final Input ls) {
MotorDispenser<?> cmf = new MotorDispenser<>() {
@Override
public Motor getMotor(ActivityDef activityDef, int slotId) {
Activity activity = new SimpleActivity(activityDef);
Motor<?> cm = new CoreMotor(activity, slotId, ls);
cm.setAction(lc);
return cm;
}
};
return cmf;
}
use of io.nosqlbench.engine.api.activityimpl.ActivityDef in project nosqlbench by nosqlbench.
the class ActivityTypeLoader method load.
public Optional<ActivityType> load(ActivityDef activityDef) {
final String driverName = activityDef.getParams().getOptionalString("driver", "type").orElseThrow(() -> new BasicError("The parameter 'driver=' is required."));
activityDef.getParams().getOptionalString("jar").map(jar -> {
Set<URL> urls = NBIO.local().search(jar).list().stream().map(Content::getURL).collect(Collectors.toSet());
return urls;
}).ifPresent(this::extendClassLoader);
return this.getDriverAdapter(driverName, activityDef).or(() -> ACTIVITYTYPE_SPI_FINDER.getOptionally(driverName));
}
use of io.nosqlbench.engine.api.activityimpl.ActivityDef in project nosqlbench by nosqlbench.
the class ScenarioController method start.
/**
* Start an activity, given a map which holds the activity definition for it. The activity will be known in
* the scenario by the alias parameter.
*
* @param activityDefMap A map containing the activity definition
*/
public synchronized void start(Map<String, String> activityDefMap) {
ActivityDef ad = new ActivityDef(new ParameterMap(activityDefMap));
start(ad);
}
Aggregations