- try {
- proc.exception(graph, (Throwable)getResult());
- } catch (Throwable t) {
- t.printStackTrace();
- }
-
- } else {
-
- try {
- proc.execute(graph, (T)getResult());
- } catch (Throwable t) {
- t.printStackTrace();
+ AsyncProcedure<T> procedure = entry != null ? entry : procedure_;
+
+ ReadGraphImpl queryGraph = entry != null ? graph.withParent(entry) : graph;
+
+ try {
+
+ T result = request.perform(queryGraph);
+ procedure.execute(graph, result);
+
+ } catch (DatabaseException e) {
+
+ procedure.exception(graph, e);
+
+ } catch (Throwable t) {
+
+ DatabaseException dbe = new DatabaseException(t);
+ procedure.exception(graph, dbe);
+
+ }
+
+ if (entry != null)
+ entry.performFromCache(queryGraph, procedure_);
+
+ }
+
+ public Object performFromCache(ReadGraphImpl graph, AsyncProcedure<T> procedure) {
+
+ AsyncProcedure<T> proc = (AsyncProcedure<T>) procedure;
+
+ if (proc != null) {
+ if (isExcepted()) {
+ try {
+ proc.exception(graph, (Throwable) getResult());
+ } catch (Throwable t) {
+ LOGGER.error("performFromCache proc.exception failed", t);
+ }
+ } else {
+ try {
+ proc.execute(graph, (T) getResult());
+ } catch (Throwable t) {
+ LOGGER.error("performFromCache proc.execute failed", t);
+ }