mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
findmax in the house
This commit is contained in:
@@ -434,6 +434,7 @@ public class ActivityExecutor implements NBLabeledElement, ParameterMap.Listener
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public synchronized void startActivity() {
|
||||
// RunStateImage startable = tally.awaitNoneOther(1000L, RunState.Uninitialized, RunState.Stopped);
|
||||
// if (startable.isTimeout()) {
|
||||
@@ -577,6 +578,11 @@ public class ActivityExecutor implements NBLabeledElement, ParameterMap.Listener
|
||||
awaitMotorsAtLeastRunning();
|
||||
}
|
||||
|
||||
public boolean awaitAllThreadsOnline(long timeoutMs) {
|
||||
RunStateImage image = tally.awaitNoneOther(timeoutMs, RunState.Running);
|
||||
return image.isNoneOther(RunState.Running);
|
||||
}
|
||||
|
||||
private class ThreadsGauge implements Gauge<Double> {
|
||||
public ThreadsGauge(ActivityExecutor activityExecutor) {
|
||||
ActivityExecutor ae = activityExecutor;
|
||||
|
||||
@@ -91,4 +91,8 @@ public class ActivityRuntimeInfo implements ProgressCapable {
|
||||
public ActivityExecutor getActivityExecutor() {
|
||||
return executor;
|
||||
}
|
||||
|
||||
public boolean awaitAllThreadsOnline(long timeoutMs) {
|
||||
return this.executor.awaitAllThreadsOnline(timeoutMs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,9 @@ public class ScenarioActivitiesController extends NBBaseComponent {
|
||||
*/
|
||||
public Activity start(Map<String, String> activityDefMap) {
|
||||
ActivityDef ad = new ActivityDef(new ParameterMap(activityDefMap));
|
||||
return start(ad);
|
||||
Activity started = start(ad);
|
||||
awaitAllThreadsOnline(started,30000L);
|
||||
return started;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,10 +176,27 @@ public class ScenarioActivitiesController extends NBBaseComponent {
|
||||
runtimeInfo.stopActivity();
|
||||
}
|
||||
|
||||
public boolean awaitAllThreadsOnline(ActivityDef activityDef, long timeoutMs) {
|
||||
ActivityRuntimeInfo runtimeInfo = this.activityInfoMap.get(activityDef.getAlias());
|
||||
if (null == runtimeInfo) {
|
||||
throw new RuntimeException("could not stop missing activity:" + activityDef);
|
||||
}
|
||||
|
||||
scenariologger.debug("STOP {}", activityDef.getAlias());
|
||||
return runtimeInfo.awaitAllThreadsOnline(timeoutMs);
|
||||
}
|
||||
|
||||
public synchronized void stop(Activity activity) {
|
||||
stop(activity.getActivityDef());
|
||||
}
|
||||
|
||||
|
||||
public boolean awaitAllThreadsOnline(Activity activity, long timeoutMs) {
|
||||
return awaitAllThreadsOnline(activity.getActivityDef(), timeoutMs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Stop an activity, given an activity def map. The only part of the map that is important is the
|
||||
* alias parameter. This method retains the map signature to provide convenience for scripting.</p>
|
||||
@@ -386,6 +405,7 @@ public class ScenarioActivitiesController extends NBBaseComponent {
|
||||
this.awaitActivity(activityDef, timeoutMs);
|
||||
}
|
||||
|
||||
|
||||
public boolean awaitActivity(ActivityDef activityDef, long timeoutMs) {
|
||||
ActivityRuntimeInfo ari = this.activityInfoMap.get(activityDef.getAlias());
|
||||
if (null == ari) {
|
||||
|
||||
Reference in New Issue
Block a user