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%2FBlockingAsyncProcedure.java;fp=bundles%2Forg.simantics.db.impl%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fimpl%2FBlockingAsyncProcedure.java;h=ecb66ff91e3ea5df7aea462e57e5d578608ee970;hp=c491fb377464e366f5b34e8e8eac2e0e205840c5;hb=a88c02c2d0f4250caf887a130b9f4314c6564722;hpb=785f638bab44e70ec6103c3891daea95bcda9a07 diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java index c491fb377..ecb66ff91 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java @@ -28,6 +28,7 @@ public class BlockingAsyncProcedure implements AsyncProcedure { public final ReadGraphImpl callerGraph; public final AsyncProcedure procedure; public PendingTaskSupport pendingTaskSupport; + public final boolean needsToBlock; public Object result = NO_RESULT; public Throwable exception = null; @@ -36,13 +37,13 @@ public class BlockingAsyncProcedure implements AsyncProcedure { } public BlockingAsyncProcedure(ReadGraphImpl callerGraph, AsyncReadEntry entry, AsyncProcedure procedure, Object key, boolean needsToBlock) { - + // A new graph for evaluating the query with correct parent and asyncBarrier queryGraph = callerGraph.withParent(entry, () -> { dispatchProcedure(queryGraph(), callerGraph, entry, procedure, needsToBlock); - }); + }, needsToBlock); queryGraph.asyncBarrier.inc(); @@ -50,6 +51,7 @@ public class BlockingAsyncProcedure implements AsyncProcedure { this.key = key; this.queryGraph.asyncBarrier.inc(); this.callerGraph = callerGraph; + this.needsToBlock = needsToBlock; if (BarrierTracing.BOOKKEEPING) { BarrierTracing.registerBAP(this); } @@ -84,7 +86,8 @@ public class BlockingAsyncProcedure implements AsyncProcedure { @SuppressWarnings("unchecked") public Result get() throws DatabaseException { - queryGraph.asyncBarrier.waitBarrier(key, queryGraph); + if(needsToBlock) + queryGraph.asyncBarrier.waitBarrier(key, queryGraph); if(exception != null) { if(exception instanceof DatabaseException) throw (DatabaseException)exception; @@ -113,7 +116,7 @@ public class BlockingAsyncProcedure implements AsyncProcedure { AsyncProcedure procedure = entry != null ? entry : procedure_; - ReadGraphImpl executeGraph = parentGraph.withParent(parentGraph.parent); + ReadGraphImpl executeGraph = parentGraph.withParent(parentGraph.parent, null, needsToBlock); executeGraph.asyncBarrier.inc(); try { if(procedure != null) {