public void put(final FlowFileRecord flowFile) { writeLock.lock(); try { if (swapMode || activeQueue.size() >= swapThreshold) { swapQueue.add(flowFile); incrementSwapQueueSize(1, flowFile.getSize(), 0); swapMode = true; writeSwapFilesIfNecessary(); } else { incrementActiveQueueSize(1, flowFile.getSize()); activeQueue.add(flowFile); } logger.debug("{} put to {}", flowFile, this); } finally { writeLock.unlock("put(FlowFileRecord)"); } }
public void putAll(final Collection<FlowFileRecord> flowFiles) { final int numFiles = flowFiles.size(); long bytes = 0L; for (final FlowFile flowFile : flowFiles) { bytes += flowFile.getSize(); } writeLock.lock(); try { if (swapMode || activeQueue.size() >= swapThreshold - numFiles) { swapQueue.addAll(flowFiles); incrementSwapQueueSize(numFiles, bytes, 0); swapMode = true; writeSwapFilesIfNecessary(); } else { incrementActiveQueueSize(numFiles, bytes); activeQueue.addAll(flowFiles); } logger.debug("{} put to {}", flowFiles, this); } finally { writeLock.unlock("putAll"); } }
incrementSwapQueueSize(-recordsMigrated, -bytesMigrated, 0);
incrementSwapQueueSize(swapFlowFileCount, swapByteCount, swapLocations.size()); this.swapLocations.addAll(swapLocations); } finally {
public void inheritQueueContents(final FlowFileQueueContents queueContents) { writeLock.lock(); try { putAll(queueContents.getActiveFlowFiles()); swapLocations.addAll(queueContents.getSwapLocations()); incrementSwapQueueSize(queueContents.getSwapSize().getObjectCount(), queueContents.getSwapSize().getByteCount(), queueContents.getSwapLocations().size()); } finally { writeLock.unlock("inheritQueueContents"); } }
final long contentSize = swapSize.getByteCount(); final int flowFileCount = swapSize.getObjectCount(); incrementSwapQueueSize(-flowFileCount, -contentSize, -1);
dropRequest.setDroppedSize(dropRequest.getDroppedSize().add(droppedSize)); swapMode = false; incrementSwapQueueSize(-droppedSize.getObjectCount(), -droppedSize.getByteCount(), 0); logger.debug("For DropFlowFileRequest {}, dropped {} from Swap Queue", requestIdentifier, droppedSize); incrementSwapQueueSize(-droppedSize.getObjectCount(), -droppedSize.getByteCount(), -1);