szaszm commented on a change in pull request #1284:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1284#discussion_r832132536
##########
File path: libminifi/src/FlowController.cpp
##########
@@ -438,30 +432,43 @@ std::shared_ptr<state::response::ResponseNode>
FlowController::getAgentManifest(
return agentInfo;
}
+void
FlowController::executeOnAllComponents(std::function<void(state::StateController*)>
func) {
+ std::lock_guard<std::recursive_mutex> lock(mutex_);
+ for (auto* component: getAllComponents()) {
+ func(component);
+ }
+}
+
+void FlowController::executeOnComponent(const std::string &name,
std::function<void(state::StateController*)> func) {
+ std::lock_guard<std::recursive_mutex> lock(mutex_);
+ if (auto* component = getComponent(name); component != nullptr) {
+ func(component);
Review comment:
The function could take a reference instead, since the pointer is always
valid.
##########
File path: libminifi/src/FlowController.cpp
##########
@@ -438,30 +432,43 @@ std::shared_ptr<state::response::ResponseNode>
FlowController::getAgentManifest(
return agentInfo;
}
+void
FlowController::executeOnAllComponents(std::function<void(state::StateController*)>
func) {
+ std::lock_guard<std::recursive_mutex> lock(mutex_);
+ for (auto* component: getAllComponents()) {
+ func(component);
+ }
Review comment:
Here as well
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]