X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.impl%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fimpl%2Fquery%2FReadEntry.java;h=4fb5ed996011a047659a22158477103d216c6f41;hp=1ceca45a5a0cec7371f632941a13b3c1610fc60a;hb=HEAD;hpb=ff1c29bf73b3e5ea939dc1987540aa0240dc4ae6 diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ReadEntry.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ReadEntry.java index 1ceca45a5..4fb5ed996 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ReadEntry.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ReadEntry.java @@ -25,20 +25,20 @@ public final class ReadEntry extends CacheEntryBase> implem private static final Logger LOGGER = LoggerFactory.getLogger(ReadEntry.class); - protected Read request; + protected Read id; public ReadEntry(Read request) { - this.request = request; + this.id = request; } @Override int makeHash() { - return request.hashCode(); + return id.hashCode(); } @Override public Object getOriginalRequest() { - return request; + return id; } @Override @@ -57,7 +57,7 @@ public final class ReadEntry extends CacheEntryBase> implem try { - T result = request.perform(graph); + T result = id.perform(graph); setResult(result); setReady(); @@ -76,8 +76,8 @@ public final class ReadEntry extends CacheEntryBase> implem @Override public int type() { - if (request instanceof ReadExt) { - return ((ReadExt) request).getType(); + if (id instanceof ReadExt) { + return ((ReadExt) id).getType(); } else { return RequestFlags.INVALIDATE; } @@ -85,10 +85,10 @@ public final class ReadEntry extends CacheEntryBase> implem @Override public String toString() { - if (request == null) + if (id == null) return "DISCARDED"; else - return request.toString() + statusOrException; + return id.toString() + statusOrException; } }; @@ -96,14 +96,14 @@ public final class ReadEntry extends CacheEntryBase> implem } public static T computeForEach(ReadGraphImpl graph, Read request, ReadEntry entry, - AsyncProcedure procedure_) throws DatabaseException { + AsyncProcedure procedure_, boolean needsToBlock) throws DatabaseException { AsyncProcedure procedure = entry != null ? entry : procedure_; - ReadGraphImpl queryGraph = graph.withParent(entry); + ReadGraphImpl queryGraph = graph.withParent(entry, null, needsToBlock); queryGraph.asyncBarrier.inc(); - ReadGraphImpl executeGraph = graph.withParent(graph.parent); + ReadGraphImpl executeGraph = graph.withParent(graph.parent, null, needsToBlock); executeGraph.asyncBarrier.inc(); try { @@ -139,7 +139,8 @@ public final class ReadEntry extends CacheEntryBase> implem } finally { executeGraph.asyncBarrier.dec(); - executeGraph.asyncBarrier.waitBarrier(procedure, executeGraph); + if(needsToBlock) + executeGraph.asyncBarrier.waitBarrier(procedure, executeGraph); } @@ -181,10 +182,10 @@ public final class ReadEntry extends CacheEntryBase> implem @Override public String toString() { - if (request == null) + if (id == null) return "DISCARDED"; else - return request.toString() + " - " + statusOrException; + return id.toString() + " - " + statusOrException; } public Object get(ReadGraphImpl graph, AsyncProcedure procedure) throws DatabaseException { @@ -196,8 +197,8 @@ public final class ReadEntry extends CacheEntryBase> implem @Override boolean isImmutable(ReadGraphImpl graph) throws DatabaseException { - if (request instanceof ReadExt) { - return ((ReadExt) request).isImmutable(graph); + if (id instanceof ReadExt) { + return ((ReadExt) id).isImmutable(graph); } return false; } @@ -213,4 +214,9 @@ public final class ReadEntry extends CacheEntryBase> implem except(throwable); } + @Override + public String classId() { + return null; + } + }