Repository: nifi Updated Branches: refs/heads/NIFI-730 570202eb3 -> edf238e00
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-730 Commit: edf238e004e45566374fcb520555cf4cc30ed8f7 Parents: 570202e Author: Mark Payne <[email protected]> Authored: Wed Oct 28 10:27:58 2015 -0400 Committer: Mark Payne <[email protected]> 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
