]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java
DB request scheduling scheme fails with district diagrams
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / graph / ReadGraphImpl.java
index 2eced2b7c046ebef86a64760cee27106667c706c..dfde4ec12973663737cb3e53244d32a0190e410a 100644 (file)
@@ -5662,7 +5662,7 @@ public class ReadGraphImpl implements AsyncReadGraph {
                this.parentGraph = parentGraph;
                this.parent = parent;
                this.processor = support;
-               this.asyncBarrier = new AsyncBarrierImpl(parentGraph != null ? parentGraph.asyncBarrier : null, parent, null);
+               this.asyncBarrier = prepareBarrier(parentGraph, parent, null, false);
        }
 
     ReadGraphImpl(ReadGraphImpl parentGraph, CacheEntry parent, QueryProcessor support, AsyncBarrierImpl asyncBarrier) {
@@ -5676,21 +5676,25 @@ public class ReadGraphImpl implements AsyncReadGraph {
                this(graph, parent, graph.processor);
        }
 
-    ReadGraphImpl(ReadGraphImpl parentGraph, CacheEntry parent, Runnable callback) {
-        this(parentGraph, parent, parentGraph.processor, new AsyncBarrierImpl(parentGraph != null ? parentGraph.asyncBarrier : null, parent, callback));
+    ReadGraphImpl(ReadGraphImpl parentGraph, CacheEntry parent, Runnable callback, boolean needsToBlock) {
+        this(parentGraph, parent, parentGraph.processor, prepareBarrier(parentGraph, parent, callback, needsToBlock));
     }
 
+    static AsyncBarrierImpl prepareBarrier(ReadGraphImpl parentGraph, CacheEntry parent, Runnable callback, boolean needsToBlock) {
+        return new AsyncBarrierImpl(parentGraph != null ? parentGraph.asyncBarrier : null, parent, callback, needsToBlock);
+    }
+    
        ReadGraphImpl(ReadGraphImpl graph) {
                this(graph, graph.parent);
        }
 
-       public ReadGraphImpl withParent(CacheEntry parent, Runnable callback) {
-               return new ReadGraphImpl(this, parent, callback);
+       public ReadGraphImpl withParent(CacheEntry parent, Runnable callback, boolean needsToBlock) {
+               return new ReadGraphImpl(this, parent, callback, needsToBlock);
        }
 
-    public ReadGraphImpl withParent(CacheEntry parent) {
-        return withParent(parent, null);
-    }
+//    public ReadGraphImpl withParent(CacheEntry parent) {
+//        return withParent(parent, null);
+//    }
 
        public ReadGraphImpl syncWithParent(CacheEntry parent) {
         return new ReadGraphImpl(this, parent, processor, null);