@Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!(obj instanceof QueueSize)) { return false; } final QueueSize other = (QueueSize) obj; return getObjectCount() == other.getObjectCount() && getByteCount() == other.getByteCount(); } }
/** * Returns a new QueueSize that is the sum of this QueueSize and the provided QueueSize * * @param other the other QueueSize to add to this QueueSize * @return a new QueueSize that is the sum of this QueueSize and the provided QueueSize */ public QueueSize add(final QueueSize other) { if (other == null) { return new QueueSize(objectCount, totalSizeBytes); } return new QueueSize(objectCount + other.getObjectCount(), totalSizeBytes + other.getByteCount()); }
private QueueSizeDTO createQueueSizeDTO(final QueueSize queueSize) { final QueueSizeDTO dto = new QueueSizeDTO(); dto.setByteCount(queueSize.getByteCount()); dto.setObjectCount(queueSize.getObjectCount()); return dto; }
private RemoteQueuePartitionDTO createRemoteQueuePartitionDto(final RemoteQueuePartitionDiagnostics queueDiagnostics) { final RemoteQueuePartitionDTO dto = new RemoteQueuePartitionDTO(); dto.setNodeIdentifier(queueDiagnostics.getNodeIdentifier()); final QueueSize activeSize = queueDiagnostics.getActiveQueueSize(); dto.setActiveQueueByteCount(activeSize.getByteCount()); dto.setActiveQueueFlowFileCount(activeSize.getObjectCount()); final QueueSize inFlightSize = queueDiagnostics.getUnacknowledgedQueueSize(); dto.setInFlightByteCount(inFlightSize.getByteCount()); dto.setInFlightFlowFileCount(inFlightSize.getObjectCount()); final QueueSize swapSize = queueDiagnostics.getSwapQueueSize(); dto.setSwapByteCount(swapSize.getByteCount()); dto.setSwapFlowFileCount(swapSize.getObjectCount()); dto.setSwapFiles(queueDiagnostics.getSwapFileCount()); dto.setTotalByteCount(activeSize.getByteCount() + inFlightSize.getByteCount() + swapSize.getByteCount()); dto.setTotalFlowFileCount(activeSize.getObjectCount() + inFlightSize.getObjectCount() + swapSize.getObjectCount()); return dto; }
public QueueSize getTotalFlowFileCount(final ProcessGroup group) { int count = 0; long contentSize = 0L; for (final Connection connection : group.getConnections()) { final QueueSize size = connection.getFlowFileQueue().size(); count += size.getObjectCount(); contentSize += size.getByteCount(); } for (final ProcessGroup childGroup : group.getProcessGroups()) { final QueueSize size = getTotalFlowFileCount(childGroup); count += size.getObjectCount(); contentSize += size.getByteCount(); } return new QueueSize(count, contentSize); }
@Override public Object getFieldValue(final String fieldName) { switch (fieldName) { case SwapSchema.MAX_RECORD_ID: return swapSummary.getMaxFlowFileId(); case SwapSchema.FLOWFILE_COUNT: return swapSummary.getQueueSize().getObjectCount(); case SwapSchema.FLOWFILE_SIZE: return swapSummary.getQueueSize().getByteCount(); case SwapSchema.QUEUE_IDENTIFIER: return queueIdentifier; case SwapSchema.RESOURCE_CLAIMS: return claimCounts; } return null; }
private LocalQueuePartitionDTO createLocalQueuePartitionDto(final LocalQueuePartitionDiagnostics queueDiagnostics) { final LocalQueuePartitionDTO dto = new LocalQueuePartitionDTO(); final QueueSize activeSize = queueDiagnostics.getActiveQueueSize(); dto.setActiveQueueByteCount(activeSize.getByteCount()); dto.setActiveQueueFlowFileCount(activeSize.getObjectCount()); final QueueSize inFlightSize = queueDiagnostics.getUnacknowledgedQueueSize(); dto.setInFlightByteCount(inFlightSize.getByteCount()); dto.setInFlightFlowFileCount(inFlightSize.getObjectCount()); final QueueSize swapSize = queueDiagnostics.getSwapQueueSize(); dto.setSwapByteCount(swapSize.getByteCount()); dto.setSwapFlowFileCount(swapSize.getObjectCount()); dto.setSwapFiles(queueDiagnostics.getSwapFileCount()); dto.setTotalByteCount(activeSize.getByteCount() + inFlightSize.getByteCount() + swapSize.getByteCount()); dto.setTotalFlowFileCount(activeSize.getObjectCount() + inFlightSize.getObjectCount() + swapSize.getObjectCount()); dto.setAllActiveQueueFlowFilesPenalized(queueDiagnostics.isAllActiveFlowFilesPenalized()); dto.setAnyActiveQueueFlowFilesPenalized(queueDiagnostics.isAnyActiveFlowFilePenalized()); return dto; }
swapByteCount += queueSize.getByteCount(); resourceClaims.addAll(summary.getResourceClaims()); } catch (final IOException ioe) {
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);
@Override public QueueSize getQueueSize() { verifyTaskActive(); int flowFileCount = 0; long byteCount = 0L; for (final Connection conn : context.getPollableConnections()) { final QueueSize queueSize = conn.getFlowFileQueue().size(); flowFileCount += queueSize.getObjectCount(); byteCount += queueSize.getByteCount(); } return new QueueSize(flowFileCount, byteCount); }
private ConnectionDiagnosticsSnapshotDTO createConnectionDiagnosticsSnapshotDto(final Connection connection) { final ConnectionDiagnosticsSnapshotDTO dto = new ConnectionDiagnosticsSnapshotDTO(); final QueueDiagnostics queueDiagnostics = connection.getFlowFileQueue().getQueueDiagnostics(); final FlowFileQueue queue = connection.getFlowFileQueue(); final QueueSize totalSize = queue.size(); dto.setTotalByteCount(totalSize.getByteCount()); dto.setTotalFlowFileCount(totalSize.getObjectCount()); final LocalQueuePartitionDiagnostics localDiagnostics = queueDiagnostics.getLocalQueuePartitionDiagnostics(); dto.setLocalQueuePartition(createLocalQueuePartitionDto(localDiagnostics)); final List<RemoteQueuePartitionDiagnostics> remoteDiagnostics = queueDiagnostics.getRemoteQueuePartitionDiagnostics(); if (remoteDiagnostics != null) { final List<RemoteQueuePartitionDTO> remoteDiagnosticsDtos = remoteDiagnostics.stream() .map(this::createRemoteQueuePartitionDto) .collect(Collectors.toList()); dto.setRemoteQueuePartitions(remoteDiagnosticsDtos); } return dto; }
incrementActiveQueueSize(-droppedSize.getObjectCount(), -droppedSize.getByteCount()); dropRequest.setCurrentSize(size()); dropRequest.setDroppedSize(dropRequest.getDroppedSize().add(droppedSize)); requestIdentifier, swapQueue.size(), swapSize.getObjectCount(), swapSize.getByteCount()); if (dropRequest.getState() == DropFlowFileState.CANCELED) { logger.info("Cancel requested for DropFlowFileRequest {}", requestIdentifier); 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); dropRequest.getDroppedSize().getObjectCount(), dropRequest.getDroppedSize().getByteCount(), getQueueIdentifier(), requestor); dropRequest.setState(DropFlowFileState.COMPLETE); } catch (final Exception e) {
adjustSize(totalQueueSize.getObjectCount(), totalQueueSize.getByteCount());
protected boolean isFull(final QueueSize queueSize) { final MaxQueueSize maxSize = getMaxQueueSize(); // Check if max size is set if (maxSize.getMaxBytes() <= 0 && maxSize.getMaxCount() <= 0) { return false; } if (maxSize.getMaxCount() > 0 && queueSize.getObjectCount() >= maxSize.getMaxCount()) { return true; } if (maxSize.getMaxBytes() > 0 && queueSize.getByteCount() >= maxSize.getMaxBytes()) { return true; } return false; }
dto.setDroppedSize(dropped.getByteCount()); dto.setDropped(FormatUtils.formatCount(dropped.getObjectCount()) + " / " + FormatUtils.formatDataSize(dropped.getByteCount())); dto.setCurrentSize(current.getByteCount()); dto.setCurrent(FormatUtils.formatCount(current.getObjectCount()) + " / " + FormatUtils.formatDataSize(current.getByteCount())); dto.setOriginalSize(original.getByteCount()); dto.setOriginal(FormatUtils.formatCount(original.getObjectCount()) + " / " + FormatUtils.formatDataSize(original.getByteCount()));
adjustSize(-partitionRequest.getDroppedSize().getObjectCount(), -partitionRequest.getDroppedSize().getByteCount()); dropRequest.setDroppedSize(new QueueSize(dropRequest.getDroppedSize().getObjectCount() + partitionRequest.getDroppedSize().getObjectCount(), dropRequest.getDroppedSize().getByteCount() + partitionRequest.getDroppedSize().getByteCount())); droppedBytes += partitionRequest.getDroppedSize().getByteCount();
hbPayload.setTotalFlowFileBytes(queueSize.getByteCount()); hbPayload.setClusterStatus(clusterCoordinator.getConnectionStatuses());
final QueueSize size = connection.getFlowFileQueue().size(); queuedCount += size.getObjectCount(); queuedContentSize += size.getByteCount();
final long connectionQueuedBytes = queueSize.getByteCount(); if (connectionQueuedCount > 0) { connStatus.setQueuedBytes(connectionQueuedBytes);