From bd4f31a4c20e104aa886edfe643b7eb175046467 Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Fri, 18 Dec 2015 11:20:37 -0500 Subject: [PATCH] NIFI-1279: Take the FlowFile's 1-up id into account for the newest and oldest flowfile prioritizers Signed-off-by: joewitt --- .../nifi/prioritizer/NewestFlowFileFirstPrioritizer.java | 7 ++++++- .../nifi/prioritizer/OldestFlowFileFirstPrioritizer.java | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) 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()); } }