tested fix for initializer race condition with multiple activities in sequence

This commit is contained in:
Jonathan Shook 2023-01-31 21:02:02 -06:00
parent 8fc5115a0c
commit d96df192b3
2 changed files with 3 additions and 3 deletions

View File

@ -109,7 +109,7 @@ public class SimpleActivity implements Activity, ProgressCapable, ActivityDefObs
} }
@Override @Override
public void initActivity() { public synchronized void initActivity() {
initOrUpdateRateLimiters(this.activityDef); initOrUpdateRateLimiters(this.activityDef);
} }
@ -353,7 +353,7 @@ public class SimpleActivity implements Activity, ProgressCapable, ActivityDefObs
* *
* @param seq - The {@link OpSequence} to derive the defaults from * @param seq - The {@link OpSequence} to derive the defaults from
*/ */
public void setDefaultsFromOpSequence(OpSequence<?> seq) { public synchronized void setDefaultsFromOpSequence(OpSequence<?> seq) {
Optional<String> strideOpt = getParams().getOptionalString("stride"); Optional<String> strideOpt = getParams().getOptionalString("stride");
if (strideOpt.isEmpty()) { if (strideOpt.isEmpty()) {
String stride = String.valueOf(seq.getSequence().length); String stride = String.valueOf(seq.getSequence().length);

View File

@ -417,7 +417,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
} }
} }
public void startActivity() { public synchronized void startActivity() {
// we need an executor service to run motor threads on // we need an executor service to run motor threads on
startMotorExecutorService(); startMotorExecutorService();
startRunningActivityThreads(); startRunningActivityThreads();