+
+ private void dispatchProcedure(ReadGraphImpl queryGraph, ReadGraphImpl parentGraph, AsyncReadEntry<Result> entry, AsyncProcedure<Result> procedure_, boolean needsToBlock) {
+
+ AsyncProcedure<Result> procedure = entry != null ? entry : procedure_;
+
+ ReadGraphImpl executeGraph = parentGraph.withParent(parentGraph.parent);
+ executeGraph.asyncBarrier.inc();
+ try {
+ if(procedure != null) {
+ procedure.execute(executeGraph, get());
+ }
+ } catch (DatabaseException e) {
+ if(procedure != null) procedure.exception(executeGraph, e);
+ exception = e;
+ } catch (Throwable t) {
+ DatabaseException dbe = new DatabaseException(t);
+ if(procedure != null) procedure.exception(executeGraph, dbe);
+ exception = dbe;
+ } finally {
+
+ if (entry != null) {
+ assert(entry.isReady());
+ // This does not throw
+ entry.performFromCache(executeGraph, procedure_);
+ }
+
+ executeGraph.asyncBarrier.dec();
+ if(needsToBlock)
+ executeGraph.asyncBarrier.waitBarrier(procedure, executeGraph);
+ }
+
+ if (BarrierTracing.BOOKKEEPING) {
+ BarrierTracing.unregisterBAP(this);
+ }
+
+ }