]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/LazyViewpoint.java
Multiple reader thread support for db client
[simantics/platform.git] / bundles / org.simantics.browsing.ui.graph.impl / src / org / simantics / browsing / ui / graph / impl / LazyViewpoint.java
index a760c848a793d0d87fed012a684087e33930d5cb..a86a172d8911b5f530755ab900941b20e9c8e150 100644 (file)
@@ -11,8 +11,6 @@
  *******************************************************************************/
 package org.simantics.browsing.ui.graph.impl;
 
-import java.util.function.Consumer;
-
 import org.simantics.browsing.ui.BuiltinKeys;
 import org.simantics.browsing.ui.DataSource;
 import org.simantics.browsing.ui.NodeContext;
@@ -20,6 +18,7 @@ import org.simantics.browsing.ui.PrimitiveQueryUpdater;
 import org.simantics.browsing.ui.common.viewpoints.ViewpointStub;
 import org.simantics.browsing.ui.content.Viewpoint;
 import org.simantics.browsing.ui.graph.impl.request.ResourceQuery;
+import org.simantics.db.AsyncReadGraph;
 import org.simantics.db.ReadGraph;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.procedure.Listener;
@@ -149,14 +148,9 @@ public abstract class LazyViewpoint extends ViewpointStub {
     public NodeContext[] getChildren() {
 
         if (children == Viewpoint.PENDING_CHILDREN) {
-            DataSource<ReadGraph> source = updater.getDataSource(ReadGraph.class);
+            DataSource<AsyncReadGraph> source = updater.getDataSource(AsyncReadGraph.class);
             final Listener<NodeContext[]> childProcedure = createListener();
-            source.schedule(new Consumer<ReadGraph>() {
-                @Override
-                public void accept(ReadGraph source) {
-                    source.asyncRequest(childQuery, childProcedure);
-                }
-            });
+            source.schedule(graph -> graph.asyncRequest(childQuery, childProcedure));
         }
 
         return children;