@Override public void put(final FlowFileRecord file) { queue.put(file); eventListener.triggerDestinationEvent(); }
@Override public void acknowledge(final FlowFileRecord flowFile) { queue.acknowledge(flowFile); eventListener.triggerSourceEvent(); }
@Override public void acknowledge(final Collection<FlowFileRecord> flowFiles) { queue.acknowledge(flowFiles); eventListener.triggerSourceEvent(); }
@Override public void putAll(final Collection<FlowFileRecord> files) { queue.putAll(files); eventListener.triggerDestinationEvent(); }
@Override public void acknowledge(final Collection<FlowFileRecord> flowFiles) { localPartition.acknowledge(flowFiles); if (!flowFiles.isEmpty()) { final long bytes = flowFiles.stream().mapToLong(FlowFileRecord::getSize).sum(); adjustSize(-flowFiles.size(), -bytes); } eventListener.triggerSourceEvent(); }
protected Map<QueuePartition, List<FlowFileRecord>> putAllAndGetPartitions(final Collection<FlowFileRecord> flowFiles) { partitionReadLock.lock(); try { // NOTE WELL: It is imperative that we adjust the size of the queue here before distributing FlowFiles to partitions. // If we do it the other way around, we could encounter a race condition where we distribute a FlowFile to the Local Partition, // but have not yet adjusted the size. The processor consuming from this queue could then poll() the FlowFile, and acknowledge it. // If that happens before we adjust the size, then we can end up with a negative Queue Size, which will throw an IllegalArgumentException, // and we end up with the wrong Queue Size. final long bytes = flowFiles.stream().mapToLong(FlowFileRecord::getSize).sum(); adjustSize(flowFiles.size(), bytes); final Map<QueuePartition, List<FlowFileRecord>> partitionMap = distributeToPartitionsAndGet(flowFiles); return partitionMap; } finally { partitionReadLock.unlock(); eventListener.triggerDestinationEvent(); } }
@Override public void acknowledge(final FlowFileRecord flowFile) { localPartition.acknowledge(flowFile); adjustSize(-1, -flowFile.getSize()); eventListener.triggerSourceEvent(); }
protected QueuePartition putAndGetPartition(final FlowFileRecord flowFile) { final QueuePartition partition; partitionReadLock.lock(); try { adjustSize(1, flowFile.getSize()); partition = getPartition(flowFile); partition.put(flowFile); } finally { partitionReadLock.unlock(); } eventListener.triggerDestinationEvent(); return partition; }