+
+ ReadGraphImpl queryGraph = graph.withParent(this);
+
+ request.perform(queryGraph, new AsyncProcedure<T>() {
+
+ @Override
+ public void execute(AsyncReadGraph returnGraph, T result) {
+ ReadGraphImpl impl = (ReadGraphImpl)returnGraph;
+ AsyncReadEntry.this.addOrSet(graph, result);
+ try {
+ procedure.execute(graph, result);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ // parentBarrier.dec(query);
+ }
+
+ @Override
+ public void exception(AsyncReadGraph returnGraph, Throwable t) {
+ ReadGraphImpl impl = (ReadGraphImpl)returnGraph;
+ // AsyncReadGraph resumeGraph = finalParentGraph.newAsync();
+ AsyncReadEntry.this.except(graph, t);
+ try {
+ procedure.exception(graph, t);
+ } catch (Throwable t2) {
+ t2.printStackTrace();
+ }
+ // parentBarrier.dec(query);
+ }
+
+ @Override
+ public String toString() {
+ return procedure.toString();
+ }
+
+ });
+
+ return getResult();
+
+ }
+
+ public static <T> void computeForEach(ReadGraphImpl parentGraph, AsyncRead<T> request, AsyncReadEntry<T> entry, AsyncProcedure<T> procedure) throws DatabaseException {
+
+ ReadGraphImpl queryGraph = parentGraph.withParent(entry);
+
+ request.perform(queryGraph, new AsyncProcedure<T>() {
+
+ @Override
+ public void execute(AsyncReadGraph returnGraph, T result) {
+ ReadGraphImpl impl = (ReadGraphImpl)returnGraph;
+ if(entry != null) entry.addOrSet(parentGraph, result);
+ try {
+ procedure.execute(parentGraph, result);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ @Override
+ public void exception(AsyncReadGraph returnGraph, Throwable t) {
+ ReadGraphImpl impl = (ReadGraphImpl)returnGraph;
+ if(entry != null) entry.except(parentGraph, t);
+ try {
+ procedure.exception(parentGraph, t);
+ } catch (Throwable t2) {
+ t2.printStackTrace();
+ }
+ }
+
+ @Override
+ public String toString() {
+ return procedure.toString();
+ }
+
+ });
+