- @Override
- public List<JSONObject> perform(ReadGraph graph) throws DatabaseException {
-
- long s = System.nanoTime();
-
+ static class CollectNodesRequest extends UnaryAsyncRead<Collection<Variable>, Collection<JSONObject>> {
+
+ public CollectNodesRequest(Collection<Variable> nodes) {
+ super(nodes);
+ }
+
+ @Override
+ public void perform(AsyncReadGraph graph, AsyncProcedure<Collection<JSONObject>> procedure) {
+ HashSet<JSONObject> rs = new HashSet<JSONObject>(); // result
+
+ for(Variable node : parameter) {
+ graph.asyncRequest(new NodeRequest(node), new AsyncProcedure<JSONObject> () {
+
+ @Override
+ public void execute(AsyncReadGraph graph, JSONObject result) {
+ synchronized(rs) {
+ rs.add(result);
+ }
+ }
+
+ @Override
+ public void exception(AsyncReadGraph graph, Throwable throwable) {
+ }
+
+ });
+
+ }
+ procedure.execute(graph, rs);
+
+ }
+
+ }
+
+ @Override
+ public List<JSONObject> perform(ReadGraph graph) throws DatabaseException {
+
+ long s = System.nanoTime();
+