szaszm commented on code in PR #1568:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1568#discussion_r1187528318


##########
libminifi/src/FlowController.cpp:
##########
@@ -127,35 +127,34 @@ bool FlowController::applyConfiguration(const std::string 
&source, const std::st
 
   logger_->log_info("Starting to reload Flow Controller with flow control name 
%s, version %d", newRoot->getName(), newRoot->getVersion());
 
-  updating_.beginUpdate();
   bool started = false;
-
   {
-    std::lock_guard<std::recursive_mutex> flow_lock(mutex_);
-    stop();
-
-    root_wrapper_.setNewRoot(std::move(newRoot));
-    initialized_ = false;
-    try {
-      load(true);
-      started = start() == 0;
-    } catch (const std::exception& ex) {
-      logger_->log_error("Caught exception while starting flow, type %s, what: 
%s", typeid(ex).name(), ex.what());
-    } catch (...) {
-      logger_->log_error("Caught unknown exception while starting flow, type 
%s", getCurrentExceptionTypeName());
-    }
-    if (!started) {
-      logger_->log_error("Failed to start new flow, restarting previous flow");
-      root_wrapper_.restoreBackup();
-      load(true);
-      start();
-    } else {
-      root_wrapper_.clearBackup();
+    auto update_lock = updating_.getUpdateLock();
+    {
+      std::lock_guard<std::recursive_mutex> flow_lock(mutex_);

Review Comment:
   The inner scope is not necessary here, the two locks could just follow each 
other.



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to