From f5727cfb0fe73b7226fe9eca96fd594f8d423ffa Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Mon, 2 Nov 2015 08:36:50 -0500 Subject: [PATCH] NIFI-730: Ensure that we always populate queue counts when initiating a Drop FlowFile request --- .../apache/nifi/controller/StandardFlowFileQueue.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowFileQueue.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowFileQueue.java index 0f6d25823a..6b6bb57340 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowFileQueue.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowFileQueue.java @@ -923,7 +923,15 @@ public final class StandardFlowFileQueue implements FlowFileQueue { } final DropFlowFileRequest dropRequest = new DropFlowFileRequest(requestIdentifier); - dropRequest.setCurrentSize(size()); + final QueueSize originalSize = getQueueSize(); + dropRequest.setCurrentSize(originalSize); + dropRequest.setOriginalSize(originalSize); + if (originalSize.getObjectCount() == 0) { + dropRequest.setDroppedSize(originalSize); + dropRequest.setState(DropFlowFileState.COMPLETE); + return dropRequest; + } + final Thread t = new Thread(new Runnable() { @Override public void run() { @@ -931,7 +939,6 @@ public final class StandardFlowFileQueue implements FlowFileQueue { try { dropRequest.setState(DropFlowFileState.DROPPING_FLOWFILES); logger.debug("For DropFlowFileRequest {}, original size is {}", requestIdentifier, getQueueSize()); - dropRequest.setOriginalSize(getQueueSize()); try { final List activeQueueRecords = new ArrayList<>(activeQueue);