amit-jain commented on code in PR #715:
URL: https://github.com/apache/jackrabbit-oak/pull/715#discussion_r976324312
##########
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:
@fabriziofortino You had a comment in the original PR which I forgot to
address. It might be better to throw in case of exceptions as it affects
correctness. @thomasmueller wdyt?
--
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]