You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by tk...@apache.org on 2015/11/03 16:36:57 UTC

[29/40] nifi git commit: NIFI-730: Ensure that we always populate queue counts when initiating a Drop FlowFile request

NIFI-730: Ensure that we always populate queue counts when initiating a Drop FlowFile request


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/f5727cfb
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/f5727cfb
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/f5727cfb

Branch: refs/heads/NIFI-274
Commit: f5727cfb0fe73b7226fe9eca96fd594f8d423ffa
Parents: edf238e
Author: Mark Payne <ma...@hotmail.com>
Authored: Mon Nov 2 08:36:50 2015 -0500
Committer: Mark Payne <ma...@hotmail.com>
Committed: Mon Nov 2 08:36:50 2015 -0500

----------------------------------------------------------------------
 .../apache/nifi/controller/StandardFlowFileQueue.java    | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/f5727cfb/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowFileQueue.java
----------------------------------------------------------------------
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 0f6d258..6b6bb57 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<FlowFileRecord> activeQueueRecords = new ArrayList<>(activeQueue);