fabriziofortino commented on code in PR #715:
URL: https://github.com/apache/jackrabbit-oak/pull/715#discussion_r990166677


##########
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/DocumentStoreIndexerBase.java:
##########
@@ -265,6 +271,55 @@ public void reindex() throws CommitFailedException, 
IOException {
         indexerSupport.postIndexWork(copyOnWriteStore);
     }
 
+    private void indexParallel(List<FlatFileStore> storeList, CompositeIndexer 
indexer, IndexingProgressReporter progressReporter) {
+        ExecutorService service = 
Executors.newFixedThreadPool(IndexerConfiguration.indexThreadPoolSize());
+        List<Future> futureList = new ArrayList<>();
+
+        for (FlatFileStore item : storeList) {
+            Future future = service.submit(new Callable<Boolean>() {
+                @Override
+                public Boolean call() throws IOException, 
CommitFailedException {
+                    for (NodeStateEntry entry : item) {
+                        reportDocumentRead(entry.getPath(), progressReporter);
+                        log.trace("Indexing : {}", entry.getPath());
+                        indexer.index(entry);
+                    }
+                    return true;
+                }
+            });
+            futureList.add(future);
+        }
+
+        try {
+            for (Future future : futureList) {
+                future.get();
+            }
+            log.info("All {} indexing jobs are done", storeList.size());
+        } catch (InterruptedException | ExecutionException e) {
+            log.error("Failure getting indexing job result", e);

Review Comment:
   I would propagate the exception and fail the indexing job.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to