From 156f859a01694337da2013f263bed0d9e60df8c9 Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Mon, 2 Mar 2020 10:09:50 +0200 Subject: [PATCH] Perform node map updates in a procedure instead of a request gitlab #92 Change-Id: I5aa6238360d84ca9c9df0c8ee1c3671ff118485c --- .../g3d/vtk/common/AbstractVTKNodeMap.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java index a42c3672..ba62ddbf 100644 --- a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java +++ b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java @@ -30,10 +30,11 @@ import org.simantics.db.ReadGraph; import org.simantics.db.Session; import org.simantics.db.UndoContext; import org.simantics.db.WriteGraph; -import org.simantics.db.common.request.ReadRequest; +import org.simantics.db.common.request.UniqueRead; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.util.Layer0Utils; +import org.simantics.db.procedure.SyncProcedure; import org.simantics.db.service.UndoRedoSupport; import org.simantics.g3d.ontology.G3D; import org.simantics.g3d.scenegraph.RenderListener; @@ -337,14 +338,23 @@ public abstract class AbstractVTKNodeMap implements VT if (graphUpdates) return; if (DEBUG)System.out.println("domainModified"); - session.asyncRequest(new ReadRequest() { - + session.asyncRequest(new UniqueRead() { + @Override + public Object perform(ReadGraph graph) throws DatabaseException { + return new Object(); + } + }, new SyncProcedure() { @Override - public void run(ReadGraph graph) throws DatabaseException { + public void execute(ReadGraph graph, Object result) throws DatabaseException { + // Perform all updates to the model in a single query thread update(graph); + }; + + @Override + public void exception(ReadGraph graph, Throwable throwable) throws DatabaseException { + LOGGER.error("Failed to update pipeline changes" + throwable); } }); - } protected void reset(ReadGraph graph) throws MappingException { -- 2.47.1