Skip to content

Commit 04414ac

Browse files
committed
Exit from PerfTestMulti when run is done
In case some threads are still running. (cherry picked from commit d45c3d6)
1 parent 4131f82 commit 04414ac

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/main/java/com/rabbitmq/perf/PerfTestMulti.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import com.google.gson.Gson;
1919
import com.google.gson.GsonBuilder;
2020
import com.rabbitmq.client.ConnectionFactory;
21+
import org.slf4j.Logger;
22+
import org.slf4j.LoggerFactory;
2123

2224
import java.io.FileInputStream;
2325
import java.io.FileNotFoundException;
@@ -31,6 +33,9 @@
3133
import java.util.Map;
3234

3335
public class PerfTestMulti {
36+
37+
private static final Logger LOGGER = LoggerFactory.getLogger(PerfTestMulti.class);
38+
3439
private static final ConnectionFactory factory = new ConnectionFactory();
3540

3641
private static final Map<String, Object> results = new HashMap<>();
@@ -53,8 +58,15 @@ public static void main(String[] args) throws Exception {
5358
System.exit(1);
5459
}
5560
Scenario[] scenarios = scenarios(json, status -> System.exit(status));
56-
runStaticBrokerTests(scenarios);
57-
writeJSON(outJSON);
61+
try {
62+
runStaticBrokerTests(scenarios);
63+
writeJSON(outJSON);
64+
System.exit(0);
65+
} catch (Exception e) {
66+
LOGGER.error("Error during test execution", e);
67+
System.exit(1);
68+
}
69+
5870
}
5971

6072
@SuppressWarnings("unchecked")

src/main/java/com/rabbitmq/perf/VaryingScenario.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public VaryingScenario(String name, ConnectionFactory factory,
4141
}
4242

4343
public void run() throws Exception {
44-
run(variables, new ArrayList<VariableValue>());
44+
run(variables, new ArrayList<>());
4545
}
4646

4747
private void run(Variable[] variables, List<VariableValue> values) throws Exception {

0 commit comments

Comments
 (0)