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:54 UTC

[26/40] nifi git commit: NIFI-730: Do not require a Read Lock in order to obtain backpressure configuration values for FlowFileQueue's

NIFI-730: Do not require a Read Lock in order to obtain backpressure configuration values for FlowFileQueue's


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

Branch: refs/heads/NIFI-274
Commit: edf238e004e45566374fcb520555cf4cc30ed8f7
Parents: 570202e
Author: Mark Payne <ma...@hotmail.com>
Authored: Wed Oct 28 10:27:58 2015 -0400
Committer: Mark Payne <ma...@hotmail.com>
Committed: Wed Oct 28 10:27:58 2015 -0400

----------------------------------------------------------------------
 .../nifi/controller/StandardFlowFileQueue.java  | 27 +++++---------------
 1 file changed, 6 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/edf238e0/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 ddb8225..0f6d258 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
@@ -82,18 +82,12 @@ public final class StandardFlowFileQueue implements FlowFileQueue {
     private PriorityQueue<FlowFileRecord> activeQueue = null;
     private ArrayList<FlowFileRecord> swapQueue = null;
 
-    // private final AtomicInteger activeQueueSizeRef = new AtomicInteger(0);
-    // private long activeQueueContentSize = 0L;
-    // private int swappedRecordCount = 0;
-    // private long swappedContentSize = 0L;
-    // private final AtomicReference<QueueSize> unacknowledgedSizeRef = new AtomicReference<>(new QueueSize(0, 0L));
-
     private final AtomicReference<FlowFileQueueSize> size = new AtomicReference<>(new FlowFileQueueSize(0, 0L, 0, 0L, 0, 0L));
 
-    private String maximumQueueDataSize;
-    private long maximumQueueByteCount;
     private boolean swapMode = false;
-    private long maximumQueueObjectCount;
+    private volatile String maximumQueueDataSize;
+    private volatile long maximumQueueByteCount;
+    private volatile long maximumQueueObjectCount;
 
     private final EventReporter eventReporter;
     private final AtomicLong flowFileExpirationMillis;
@@ -104,6 +98,7 @@ public final class StandardFlowFileQueue implements FlowFileQueue {
     private final int swapThreshold;
     private final FlowFileSwapManager swapManager;
     private final List<String> swapLocations = new ArrayList<>();
+    @SuppressWarnings("unused")
     private final TimedLock readLock;
     private final TimedLock writeLock;
     private final String identifier;
@@ -178,12 +173,7 @@ public final class StandardFlowFileQueue implements FlowFileQueue {
 
     @Override
     public long getBackPressureObjectThreshold() {
-        readLock.lock();
-        try {
-            return maximumQueueObjectCount;
-        } finally {
-            readLock.unlock("getBackPressureObjectThreshold");
-        }
+        return maximumQueueObjectCount;
     }
 
     @Override
@@ -200,12 +190,7 @@ public final class StandardFlowFileQueue implements FlowFileQueue {
 
     @Override
     public String getBackPressureDataSizeThreshold() {
-        readLock.lock();
-        try {
-            return maximumQueueDataSize;
-        } finally {
-            readLock.unlock("getBackPressureDataSizeThreshold");
-        }
+        return maximumQueueDataSize;
     }
 
     @Override