diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-prioritizers/src/main/java/org/apache/nifi/prioritizer/NewestFlowFileFirstPrioritizer.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-prioritizers/src/main/java/org/apache/nifi/prioritizer/NewestFlowFileFirstPrioritizer.java index 9b2ffdd5db..515993ea42 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-prioritizers/src/main/java/org/apache/nifi/prioritizer/NewestFlowFileFirstPrioritizer.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-prioritizers/src/main/java/org/apache/nifi/prioritizer/NewestFlowFileFirstPrioritizer.java @@ -31,7 +31,12 @@ public class NewestFlowFileFirstPrioritizer implements FlowFilePrioritizer { return 1; } - return Long.compare(o2.getLineageStartDate(), o1.getLineageStartDate()); + final int lineageDateCompare = Long.compare(o2.getLineageStartDate(), o1.getLineageStartDate()); + if (lineageDateCompare != 0) { + return lineageDateCompare; + } + + return Long.compare(o2.getId(), o1.getId()); } } diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-prioritizers/src/main/java/org/apache/nifi/prioritizer/OldestFlowFileFirstPrioritizer.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-prioritizers/src/main/java/org/apache/nifi/prioritizer/OldestFlowFileFirstPrioritizer.java index bd0e5a88ad..b4781f3051 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-prioritizers/src/main/java/org/apache/nifi/prioritizer/OldestFlowFileFirstPrioritizer.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-prioritizers/src/main/java/org/apache/nifi/prioritizer/OldestFlowFileFirstPrioritizer.java @@ -31,7 +31,12 @@ public class OldestFlowFileFirstPrioritizer implements FlowFilePrioritizer { return 1; } - return Long.compare(o1.getLineageStartDate(), o2.getLineageStartDate()); + final int lineageDateCompare = Long.compare(o1.getLineageStartDate(), o2.getLineageStartDate()); + if (lineageDateCompare != 0) { + return lineageDateCompare; + } + + return Long.compare(o1.getId(), o2.getId()); } }