From f17fbfa5997da6f3a08b0c4603bbc055eef5eabe Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Fri, 12 Oct 2018 14:39:29 +0300 Subject: [PATCH] Fixed another source of deadlocks in DynamicExperimentThread. gitlab #136 Change-Id: Iabeef360c93d617a38cbc7883533c3cb487ae6f2 (cherry picked from commit 685ae86876e6c246694bc6a94eac717ccb1e28cc) --- .../simulator/toolkit/DynamicExperimentThread.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/DynamicExperimentThread.java b/bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/DynamicExperimentThread.java index 0967bfdbc..9ee57f510 100644 --- a/bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/DynamicExperimentThread.java +++ b/bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/DynamicExperimentThread.java @@ -138,10 +138,12 @@ abstract public class DynamicExperimentThread extends Thread { if(deltaNs > 0) { synchronized(tasks) { - try { - tasks.wait(deltaMs, deltaNsRem); - } catch (InterruptedException e) { - e.printStackTrace(); + if (inState(StandardExperimentStates.Running.class)) { + try { + tasks.wait(deltaMs, deltaNsRem); + } catch (InterruptedException e) { + LOGGER.warn("Dynamic experiment thread '" + this.getName() + "' (" + this.getClass().getName() + ") interrupted", e); + } } } } @@ -158,7 +160,7 @@ abstract public class DynamicExperimentThread extends Thread { try { tasks.wait(Integer.MAX_VALUE); } catch (InterruptedException e) { - e.printStackTrace(); + LOGGER.warn("Dynamic experiment thread '" + this.getName() + "' (" + this.getClass().getName() + ") interrupted", e); } } } -- 2.47.1