- public void perform(AsyncReadGraph graph, AsyncMultiProcedure<Resource> procedure) {
- graph.forEachAssertedObject(resource, resource2, procedure);
+ public Collection<Resource> perform(ReadGraph graph) throws DatabaseException {
+ CollectionSupport cs = graph.getService(CollectionSupport.class);
+ Collection<Resource> result = cs.createSet();
+ DataContainer<Throwable> throwable = new DataContainer<Throwable>(null);
+ graph.forEachAssertedObject(resource, resource2, new AsyncMultiProcedure<Resource>() {
+
+ @Override
+ public void finished(AsyncReadGraph graph) {
+ }
+
+ @Override
+ public void execute(AsyncReadGraph graph, Resource r) {
+ result.add(r);
+ }
+
+ @Override
+ public void exception(AsyncReadGraph graph, Throwable t) {
+ throwable.set(t);
+ }
+ });
+ Throwable t = throwable.get();
+ if(t != null)
+ if(t instanceof DatabaseException)
+ throw (DatabaseException)t;
+ else throw new DatabaseException(t);
+ return result;