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


##########
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/StoreAndSortStrategy.java:
##########
@@ -42,31 +45,36 @@
 import static 
org.apache.jackrabbit.oak.index.indexer.document.flatfile.FlatFileNodeStoreBuilder.OAK_INDEXER_MAX_SORT_MEMORY_IN_GB_DEFAULT;
 import static 
org.apache.jackrabbit.oak.index.indexer.document.flatfile.FlatFileStoreUtils.getSortedStoreFileName;
 
-class StoreAndSortStrategy implements SortStrategy {
+class StoreAndSortStrategy extends IndexStoreSortStrategyBase {
     private static final String OAK_INDEXER_DELETE_ORIGINAL = 
"oak.indexer.deleteOriginal";
     private static final int LINE_SEP_LENGTH = LINE_SEPARATOR.value().length();
 
     private final Logger log = LoggerFactory.getLogger(getClass());
     private final NodeStateEntryTraverserFactory nodeStatesFactory;
     private final PathElementComparator comparator;
     private final NodeStateEntryWriter entryWriter;
-    private final File storeDir;
-    private final Compression algorithm;
     private long entryCount;
     private boolean deleteOriginal = 
Boolean.parseBoolean(System.getProperty(OAK_INDEXER_DELETE_ORIGINAL, "true"));
     private int maxMemory = 
Integer.getInteger(OAK_INDEXER_MAX_SORT_MEMORY_IN_GB, 
OAK_INDEXER_MAX_SORT_MEMORY_IN_GB_DEFAULT);
     private long textSize;
-    private Predicate<String> pathPredicate;
 
+    public StoreAndSortStrategy(NodeStateEntryTraverserFactory 
nodeStatesFactory, Set<String> preferredPaths,
+                                NodeStateEntryWriter entryWriter, File 
storeDir, Compression algorithm,
+                                Predicate<String> pathPredicate, String 
checkpoint) {
+        super(storeDir, algorithm, pathPredicate,preferredPaths, checkpoint);
+        this.nodeStatesFactory = nodeStatesFactory;
+        this.comparator = new PathElementComparator(preferredPaths);
+        this.entryWriter = entryWriter;
+
+    }
 
+    @Deprecated
     public StoreAndSortStrategy(NodeStateEntryTraverserFactory 
nodeStatesFactory, PathElementComparator comparator,
                                 NodeStateEntryWriter entryWriter, File 
storeDir, Compression algorithm, Predicate<String> pathPredicate) {
+        super(storeDir, algorithm, pathPredicate, null, null);
         this.nodeStatesFactory = nodeStatesFactory;
         this.comparator = comparator;
         this.entryWriter = entryWriter;
-        this.storeDir = storeDir;
-        this.algorithm = algorithm;
-        this.pathPredicate = pathPredicate;

Review Comment:
   I didn't wanted to add both comparator and preferredPaths in constructor as 
comparator can be derived from  preferredPaths.
   This will also lead to double initialisation of final comparator, as 
comparator is also initialised in other constructor.  



-- 
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: dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to