mirror of https://github.com/apache/nifi.git
NIFI-882: When a ProcessGroup is removed from the graph, ensure that the removeXYZ method is called for each component in that Process Group so that resources are appropriately cleaned up
This commit is contained in:
parent
1ddd736558
commit
d351f3ed1b
|
@ -558,14 +558,48 @@ public final class StandardProcessGroup implements ProcessGroup {
|
|||
}
|
||||
toRemove.verifyCanDelete();
|
||||
|
||||
removeComponents(group);
|
||||
processGroups.remove(group.getIdentifier());
|
||||
|
||||
LOG.info("{} removed from flow", group);
|
||||
} finally {
|
||||
writeLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private void removeComponents(final ProcessGroup group) {
|
||||
for (final Connection connection : new ArrayList<>(group.getConnections())) {
|
||||
group.removeConnection(connection);
|
||||
}
|
||||
|
||||
for (final Port port : new ArrayList<>(group.getInputPorts())) {
|
||||
group.removeInputPort(port);
|
||||
}
|
||||
|
||||
for (final Port port : new ArrayList<>(group.getOutputPorts())) {
|
||||
group.removeOutputPort(port);
|
||||
}
|
||||
|
||||
for (final Funnel funnel : new ArrayList<>(group.getFunnels())) {
|
||||
group.removeFunnel(funnel);
|
||||
}
|
||||
|
||||
for (final ProcessorNode processor : new ArrayList<>(group.getProcessors())) {
|
||||
group.removeProcessor(processor);
|
||||
}
|
||||
|
||||
for (final RemoteProcessGroup rpg : new ArrayList<>(group.getRemoteProcessGroups())) {
|
||||
group.removeRemoteProcessGroup(rpg);
|
||||
}
|
||||
|
||||
for (final Label label : new ArrayList<>(group.getLabels())) {
|
||||
group.removeLabel(label);
|
||||
}
|
||||
|
||||
for (final ProcessGroup childGroup : new ArrayList<>(group.getProcessGroups())) {
|
||||
group.removeProcessGroup(childGroup);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRemoteProcessGroup(final RemoteProcessGroup remoteGroup) {
|
||||
writeLock.lock();
|
||||
|
|
Loading…
Reference in New Issue