improvements to motor state model and activity

nb5/pom.xml version

squash
This commit is contained in:
Jonathan Shook 2023-02-03 17:07:46 -06:00 committed by Madhavan Sridharan
parent 6c4a8351d3
commit 318e26ca30
4 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,5 @@
<!--
~ Copyright (c) 2022 nosqlbench
~ Copyright (c) 2023 nosqlbench
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@ -20,7 +20,7 @@
<parent>
<groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId>
<version>5.17.1-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -37,17 +37,17 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>adapters-api</artifactId>
<version>5.17.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>5.17.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>nb-annotations</artifactId>
<version>5.17.1-SNAPSHOT</version>
<version>${revision}</version>
<scope>compile</scope>
</dependency>

View File

@ -106,7 +106,7 @@ public enum RunState {
case Stopping, Finished, Errored -> true;// A motor has exhausted its input, and is finished with its work
default -> false;
};
case Stopping -> (target == Stopped||target==Finished); // A motor was stopped by request before exhausting input
case Stopping -> (target == Stopped||target==Finished||target==Errored); // A motor was stopped by request before exhausting input
case Finished -> (target == Running); // A motor was restarted?
case Errored -> target==Errored;
};

View File

@ -87,10 +87,10 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
activity.setRunState(RunState.Stopping);
motors.forEach(Motor::requestStop);
tally.awaitNoneOther(RunState.Stopped, RunState.Finished);
tally.awaitNoneOther(RunState.Stopped, RunState.Finished, RunState.Errored);
shutdownExecutorService(Integer.MAX_VALUE);
tally.awaitNoneOther(RunState.Stopped, RunState.Finished);
tally.awaitNoneOther(RunState.Stopped, RunState.Finished, RunState.Errored);
activity.setRunState(RunState.Stopped);
logger.info(() -> "stopped: " + this.getActivityDef().getAlias() + " with " + motors.size() + " slots");
@ -349,7 +349,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
return activity;
}
public void notifyException(Thread t, Throwable e) {
public synchronized void notifyException(Thread t, Throwable e) {
logger.debug(() -> "Uncaught exception in activity thread forwarded to activity executor: " + e.getMessage());
this.exception = new RuntimeException("Error in activity thread " + t.getName(), e);
this.requestStopMotors();

View File

@ -134,7 +134,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>adapter-jdbc</artifactId>
<version>5.17.1-SNAPSHOT</version>
<version>${revision}</version>
</dependency>
</dependencies>