From: Reino Ruusu Date: Fri, 12 Oct 2018 11:39:29 +0000 (+0300) Subject: Fixed another source of deadlocks in DynamicExperimentThread. X-Git-Tag: v1.43.0~136^2~331 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=f17fbfa5997da6f3a08b0c4603bbc055eef5eabe;p=simantics%2Fplatform.git Fixed another source of deadlocks in DynamicExperimentThread. gitlab #136 Change-Id: Iabeef360c93d617a38cbc7883533c3cb487ae6f2 (cherry picked from commit 685ae86876e6c246694bc6a94eac717ccb1e28cc) --- 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); } } }