]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/LazyResourceQueryContainer.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 / LazyResourceQueryContainer.java
index c694ba2e88291a52661a178438e60afc2ddc17be..808193a18982d11d672a26d7984dc34f20146e06 100644 (file)
  *******************************************************************************/
 package org.simantics.browsing.ui.graph.impl;
 
-import java.util.function.Consumer;
-
 import org.simantics.browsing.ui.DataSource;
 import org.simantics.browsing.ui.NodeContext;
 import org.simantics.browsing.ui.NodeContext.PrimitiveQueryKey;
 import org.simantics.browsing.ui.PrimitiveQueryProcessor;
 import org.simantics.browsing.ui.PrimitiveQueryUpdater;
 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;
@@ -113,19 +112,10 @@ public abstract class LazyResourceQueryContainer<Result> implements Container<Re
 
         if (!computed) {
 
-            final DataSource<ReadGraph> source = updater.getDataSource(ReadGraph.class);
+            final DataSource<AsyncReadGraph> source = updater.getDataSource(AsyncReadGraph.class);
             assert(source != null);
 
-            source.schedule(new Consumer<ReadGraph>() {
-
-                @Override
-                public void accept(ReadGraph source) {
-
-                    source.asyncRequest(query, procedure);
-
-                }
-
-            });
+            source.schedule(graph -> graph.asyncRequest(query, procedure));
 
         }