public final ReadGraphImpl callerGraph;
public final AsyncProcedure<Result> procedure;
public PendingTaskSupport pendingTaskSupport;
+ public final boolean needsToBlock;
public Object result = NO_RESULT;
public Throwable exception = null;
}
public BlockingAsyncProcedure(ReadGraphImpl callerGraph, AsyncReadEntry<Result> entry, AsyncProcedure<Result> 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();
this.key = key;
this.queryGraph.asyncBarrier.inc();
this.callerGraph = callerGraph;
+ this.needsToBlock = needsToBlock;
if (BarrierTracing.BOOKKEEPING) {
BarrierTracing.registerBAP(this);
}
@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;
AsyncProcedure<Result> 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) {