Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ private PeerStatus getAvailablePeerStatus(Map<PeerStatus, Double> orderedPeerSta
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));

final double totalWeights = sumMapValues(unpenalizedPeers);
logger.debug("Determining next available peer ({} peers with total weight {})", unpenalizedPeers.keySet().size(), totalWeights);
logger.debug("Determining next available peer ({} peers with total weight {})", unpenalizedPeers.size(), totalWeights);

final double random = Math.random() * Math.min(100, totalWeights);
logger.debug("Generated random value {}", random);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
List<WriteModel<Document>> updateModels = new ArrayList<>();
for (Object item : updateItems) {
final BsonDocument updateItem = (BsonDocument) item;
if (updateItem.keySet().size() != 1) {
if (updateItem.size() != 1) {
getLogger().error("Invalid bulk-update in {}: more than one type given {}", flowFile, String.join(", ", updateItem.keySet()));
session.transfer(flowFile, REL_FAILURE);
context.yield();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public Map<PropertyDescriptor, String> getProperties() {

@Override
public PropertyValue getProperty(PropertyDescriptor descriptor) {
if (properties.keySet().contains(descriptor)) {
if (properties.containsKey(descriptor)) {
return super.getProperty(descriptor);
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public void onTrigger(ProcessContext context, ProcessSession session) throws Pro

//escape attribute values
int index = 0;
final int atrListSize = atrList.values().size() - 1;
final int atrListSize = atrList.size() - 1;
final StringBuilder sbValues = new StringBuilder();
for (final Map.Entry<String, String> attr : atrList.entrySet()) {
sbValues.append(StringEscapeUtils.escapeCsv(attr.getValue()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class NodeStatusResultProcessor implements QueryResultProcessor<List<Stand
public void processRow(final QueryRowContext context) {
final long createdAt = TimeUnit.MICROSECONDS.toMillis(context.getTimestamp(0));
final Map<StandardMetricDescriptor<NodeStatus>, Long> storageMetrics = storageMetricsByTime.get(createdAt);
final Set<MetricDescriptor<?>> snapshotMetrics = new HashSet<>(metricDescriptors.size() + storageMetrics.keySet().size());
final Set<MetricDescriptor<?>> snapshotMetrics = new HashSet<>(metricDescriptors.size() + storageMetrics.size());
snapshotMetrics.addAll(metricDescriptors.values());
snapshotMetrics.addAll(storageMetrics.keySet());
final StandardStatusSnapshot snapshot = new StandardStatusSnapshot(snapshotMetrics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,7 @@ public void addConnection(final Connection connection) throws IllegalArgumentExc

// don't add the connection twice. This may occur if we have a self-loop because we will be told
// to add the connection once because we are the source and again because we are the destination.
if (!outgoingConnections.contains(connection)) {
outgoingConnections.add(connection);
}
outgoingConnections.add(connection);
} finally {
writeLock.unlock();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ private void mergeParameterContexts(final RegisteredFlowSnapshot childSnapshot)
}
final Set<VersionedParameter> childParameters = childContext.getParameters() == null ? Collections.emptySet() : childContext.getParameters();
for (final VersionedParameter childParameter : childParameters) {
if (!matchingContext.getParameters().contains(childParameter)) {
matchingContext.getParameters().add(childParameter);
}
matchingContext.getParameters().add(childParameter);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void shutdown() {
@Override
public void doSchedule(final ReportingTaskNode taskNode, final LifecycleState scheduleState) {
final Map<Integer, ScheduledFuture<?>> componentFuturesMap = scheduledFutures.computeIfAbsent(taskNode, k -> new HashMap<>());
if (!componentFuturesMap.values().isEmpty()) {
if (!componentFuturesMap.isEmpty()) {
throw new IllegalStateException("Cannot schedule " + taskNode.getReportingTask().getIdentifier() + " because it is already scheduled to run");
}

Expand Down Expand Up @@ -99,7 +99,7 @@ public void run() {
@Override
public synchronized void doSchedule(final Connectable connectable, final LifecycleState scheduleState) {
final Map<Integer, ScheduledFuture<?>> componentFuturesMap = scheduledFutures.computeIfAbsent(connectable, k -> new HashMap<>());
if (!componentFuturesMap.values().isEmpty()) {
if (!componentFuturesMap.isEmpty()) {
throw new IllegalStateException("Cannot schedule " + connectable + " because it is already scheduled to run");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6532,7 +6532,7 @@ private RegisteredFlowSnapshot buildFlowSnapshot(final ProcessGroup processGroup
final VersionedControllerService versionedControllerService =
mapper.mapControllerService(controllerServiceNode, controllerFacade.getControllerServiceProvider(), getAllSubGroups(processGroup), externalControllerServiceReferences);

if (externalControllerServiceReferences.keySet().contains(versionedControllerService.getIdentifier())) {
if (externalControllerServiceReferences.containsKey(versionedControllerService.getIdentifier())) {
versionedControllerService.setGroupIdentifier(processGroupId);
versionedControllerService.setComponentState(null);
externalServices.add(versionedControllerService);
Expand Down
Loading