tihom88 commented on code in PR #1123:
URL: https://github.com/apache/jackrabbit-oak/pull/1123#discussion_r1331040826


##########
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/MultithreadedTraverseWithSortStrategy.java:
##########
@@ -234,18 +230,42 @@ public int getValue() {
      *                             previous runs stopped). If this is not null 
and not empty, the {@code lastModifiedBreakPoints} parameter is ignored.
      * @param algorithm string representation of the compression algorithm, 
use "none" for disable compression.
      */
+    @Deprecated
     MultithreadedTraverseWithSortStrategy(NodeStateEntryTraverserFactory 
nodeStateEntryTraverserFactory,
                                           List<Long> lastModifiedBreakPoints, 
PathElementComparator pathComparator,
                                           BlobStore blobStore, File storeDir, 
List<File> existingDataDumpDirs,
                                           Compression algorithm, MemoryManager 
memoryManager, long dumpThreshold,
                                           Predicate<String> pathPredicate) 
throws IOException {
-        this.storeDir = storeDir;
+        super(storeDir, algorithm, pathPredicate, null, null);
         this.mergeDir = new File(storeDir, mergeDirName);
-        this.algorithm = algorithm;
         this.sortedFiles = new LinkedBlockingQueue<>();
         this.throwables = new ConcurrentLinkedQueue<>();
         this.comparator = (e1, e2) -> 
pathComparator.compare(e1.getPathElements(), e2.getPathElements());
-        this.pathPredicate = pathPredicate;
+        taskQueue = new LinkedBlockingQueue<>();
+        phaser = new Phaser() {
+            @Override
+            protected boolean onAdvance(int phase, int registeredParties) {
+                //terminate phaser only if it is advancing from last phase and 
there are no registered parties
+                return phase == Phases.WAITING_FOR_RESULTS.value && 
registeredParties == 0;
+            }
+        };
+        // arrives on final file sorted
+        mergePhaser = new Phaser(1);

Review Comment:
   We can remove this duplication but to do that access modifiers of some 
variables need to be changed. Let me know if you feel that is the right 
approach. We can discuss this.



-- 
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