From dcce41f96d6eacecb16a79f12718db662918232e Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Mon, 26 Feb 2024 14:32:54 -0500 Subject: [PATCH] chore(automatedanalysis): use independent singlethreadexecutor if running on single CPU (#297) --- src/main/java/io/cryostat/Producers.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/cryostat/Producers.java b/src/main/java/io/cryostat/Producers.java index 4fdc29f61..7233886d3 100644 --- a/src/main/java/io/cryostat/Producers.java +++ b/src/main/java/io/cryostat/Producers.java @@ -94,7 +94,9 @@ public static ScheduledExecutorService produceScheduledExecutorService() { @RequestScoped @DefaultBean public static InterruptibleReportGenerator produceInterruptibleReportGenerator() { - return new InterruptibleReportGenerator(ForkJoinPool.commonPool()); + boolean singleThread = Runtime.getRuntime().availableProcessors() < 2; + return new InterruptibleReportGenerator( + singleThread ? Executors.newSingleThreadExecutor() : ForkJoinPool.commonPool()); } @Produces