X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.impl%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fimpl%2Fquery%2FExternalReadEntry.java;h=8d7b0597fde5e3563649befe516e26f61a00484c;hb=56791857e209f32cb6f3daef56991a39653214fc;hp=d044043394ef771f7e7e0cfab3e5257f77883db6;hpb=85fd9f0a35ca2d7018b316bc8bcc280513b47243;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ExternalReadEntry.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ExternalReadEntry.java index d04404339..8d7b0597f 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ExternalReadEntry.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ExternalReadEntry.java @@ -28,7 +28,7 @@ final public class ExternalReadEntry extends CacheEntryBase final LinkedList items = new LinkedList(); protected ExternalRead id; - protected ReadGraphImpl graph; + protected QueryProcessor processor; protected boolean registered = false; @Override @@ -49,7 +49,7 @@ final public class ExternalReadEntry extends CacheEntryBase public void discard() { id.unregistered(); id = null; - graph = null; + processor = null; super.discard(); } @@ -65,7 +65,7 @@ final public class ExternalReadEntry extends CacheEntryBase public ExternalReadEntry(ExternalRead request, ReadGraphImpl graph) { assert request != null; this.id = request; - this.graph = graph; + this.processor = graph.processor; } @Override @@ -181,13 +181,15 @@ final public class ExternalReadEntry extends CacheEntryBase try { ReadGraphImpl queryGraph = graph.withParent(this, null, true); + queryGraph.asyncBarrier.inc(); - if(!registered) { - id.register(graph, this); + if (!registered) { + id.register(queryGraph, this); registered = true; } - - queryGraph.asyncBarrier.waitBarrier(id, graph); + + queryGraph.asyncBarrier.dec(); + queryGraph.asyncBarrier.waitBarrier(id, queryGraph); } catch (Throwable t) { @@ -213,7 +215,7 @@ final public class ExternalReadEntry extends CacheEntryBase synchronized(items) { items.addLast(result); - graph.processor.updatePrimitive(id); + processor.updatePrimitive(id); // TODO: implement flags/logic in ExternalRead to state that all but the latest request result can be evaporated // In some cases where data is produced really fast this might be necessary but currently this queueing will do. } @@ -229,7 +231,7 @@ final public class ExternalReadEntry extends CacheEntryBase @Override public boolean isDisposed() { - return registered && (isDiscarded() || !graph.processor.isBound(this)); + return registered && (isDiscarded() || !processor.isBound(this)); } }