- public void exception(AsyncReadGraph returnGraph, Throwable t) {
- try {
- procedure.exception(parentGraph, t);
- } catch (Throwable t2) {
- LOGGER.error("computeForEach procedure.exception failed", t2);
+ public void run0(int thread) {
+ if(needsToBlock) proc.waitBarrier();
+ if(proc.isDone()) {
+ ReadGraphImpl executeGraph = graph.withParent(graph.parent);
+ executeGraph.asyncBarrier.inc();
+ try {
+ result = (T)proc.get();
+ if(procedure != null) {
+ procedure.execute(executeGraph, result);
+ }
+ } 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) {
+ // This does not throw
+ entry.performFromCache(executeGraph, procedure_);
+ }
+ executeGraph.asyncBarrier.dec();
+ executeGraph.asyncBarrier.waitBarrier(procedure, executeGraph);
+ }
+ } else {
+ if(counter++ > 10000) {
+ if(BarrierTracing.BOOKKEEPING) {
+ AsyncBarrierImpl.printReverse(queryGraph.asyncBarrier, 2);
+ AsyncBarrierImpl caller = queryGraph.asyncBarrier.caller;
+ while(caller != null) {
+ System.err.println("called by " + AsyncBarrierImpl.report(caller));
+ caller = caller.caller;
+ }
+ for(AsyncBarrierImpl ab : BarrierTracing.debuggerMap.keySet()) {
+ AsyncBarrierImpl.printReverse(ab, 2);
+ }
+ }
+ throw new IllegalStateException("Eternal loop in queries.");
+ }
+ graph.processor.schedule(new AsyncTask(graph));