From: jkauttio Date: Thu, 11 Jun 2015 09:43:38 +0000 (+0000) Subject: Remove an unnecessary async transaction from experiment initialization (caused a... X-Git-Tag: v1.29.0~67 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=e53b1b30f3fe83efc75b016f66495638d3740c2d;p=simantics%2Fsysdyn.git Remove an unnecessary async transaction from experiment initialization (caused a race condition when an experiment was initialized with SCL) refs #5895 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@31402 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java index 54f8aa28..852153bc 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java @@ -97,7 +97,7 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment, * Initialize this experiment * @param g ReadGraph */ - public void init(ReadGraph g) { + public void init(ReadGraph g) throws DatabaseException { try { this.experimentName = NameUtils.getSafeName(g, experiment); } catch (DatabaseException e) { @@ -108,16 +108,10 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment, state = ExperimentState.STOPPED; for(IExperimentListener listener : listeners.getListeners()) listener.stateChanged(state); - - session.asyncRequest(new ReadRequest() { - - @Override - public void run(ReadGraph graph) throws DatabaseException { - final Resource configuration = graph.getPossibleObject(model, SimulationResource.getInstance(graph).HasConfiguration); - sysdynModel = SysdynModelManager.getInstance(session).getModel(graph, configuration); - toggleActivation(graph, true); - } - }); + + final Resource configuration = g.getPossibleObject(model, SimulationResource.getInstance(g).HasConfiguration); + sysdynModel = SysdynModelManager.getInstance(session).getModel(g, configuration); + toggleActivation(g, true); setSysdynExperimentState(ExperimentState.INITIALIZING); }