[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a diff in pull request #1458: MINIFICPP-1991 - Remove unused ControllerServiceProvider methods

2023-01-06 Thread GitBox


adamdebreceni commented on code in PR #1458:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1458#discussion_r1063394152


##
extensions/http-curl/tests/ControllerServiceIntegrationTests.cpp:
##
@@ -108,27 +108,28 @@ int main(int argc, char **argv) {
   assert(ssl_client->getCACertificate().length() > 0);
   // now let's disable one of the controller services.
   std::shared_ptr cs_id = 
controller->getControllerServiceNode("ID");
-  const auto checkCsIdEnabledMatchesDisabledFlag = [_id] { return !disabled 
== cs_id->enabled(); };
   assert(cs_id != nullptr);
-  {
-std::lock_guard lock(control_mutex);
-controller->enableControllerService(cs_id);
-disabled = false;
-  }
-  std::shared_ptr mock_cont = 
controller->getControllerServiceNode("MockItLikeIts1995");
-  assert(verifyEventHappenedInPollTime(std::chrono::seconds(4), 
checkCsIdEnabledMatchesDisabledFlag));
-  {
-std::lock_guard lock(control_mutex);
-controller->disableReferencingServices(mock_cont);
-disabled = true;
-  }
-  assert(verifyEventHappenedInPollTime(std::chrono::seconds(2), 
checkCsIdEnabledMatchesDisabledFlag));
-  {
-std::lock_guard lock(control_mutex);
-controller->enableReferencingServices(mock_cont);
-disabled = false;
-  }
-  assert(verifyEventHappenedInPollTime(std::chrono::seconds(2), 
checkCsIdEnabledMatchesDisabledFlag));
+  // TODO(adebreceni): MINIFICPP-1992

Review Comment:
   thank you for adding it



-- 
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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a diff in pull request #1458: MINIFICPP-1991 - Remove unused ControllerServiceProvider methods

2023-01-06 Thread GitBox


adamdebreceni commented on code in PR #1458:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1458#discussion_r1063392329


##
libminifi/include/core/ProcessGroup.h:
##
@@ -231,7 +231,7 @@ class ProcessGroup : public CoreComponent {
   void verify() const;
 
  protected:
-  void startProcessingProcessors(const 
std::shared_ptr& timeScheduler, const 
std::shared_ptr , const 
std::shared_ptr ); // NOLINT
+  void startProcessingProcessors(TimerDrivenSchedulingAgent& timeScheduler, 
EventDrivenSchedulingAgent& eventScheduler, CronDrivenSchedulingAgent& 
cronScheduler); // NOLINT

Review Comment:
   removed it



-- 
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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a diff in pull request #1458: MINIFICPP-1991 - Remove unused ControllerServiceProvider methods

2023-01-05 Thread GitBox


adamdebreceni commented on code in PR #1458:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1458#discussion_r1062425264


##
libminifi/include/utils/ThreadPool.h:
##
@@ -296,6 +297,9 @@ class ThreadPool {
   std::this_thread::sleep_for(std::chrono::milliseconds(1));
 }
   }
+
+  static std::shared_ptr logger_;

Review Comment:
   moved it into the object



##
libminifi/src/utils/ThreadPool.cpp:
##
@@ -182,15 +185,22 @@ void ThreadPool::manageWorkers() {
 
 template
 void ThreadPool::start() {
-  if (nullptr != controller_service_provider_) {
-auto thread_man = 
controller_service_provider_->getControllerService("ThreadPoolManager");
-thread_manager_ = thread_man != nullptr ? 
std::dynamic_pointer_cast(thread_man) : 
nullptr;
-  } else {
-thread_manager_ = nullptr;
-  }
-
   std::lock_guard lock(manager_mutex_);
   if (!running_) {
+thread_manager_.reset();
+if (nullptr != controller_service_provider_) {
+  auto service = 
controller_service_provider_->getControllerService("ThreadPoolManager");
+  if (!service) {
+logger_->log_info("Could not find a ThreadPoolManager service");
+  } else {
+if (auto thread_manager_service = 
std::dynamic_pointer_cast(service)) {
+  thread_manager_ = thread_manager_service;
+} else {
+  logger_->log_error("Found ThreadPoolManager, but it is not a 
ThreadManagementService");
+}
+  }
+}

Review Comment:
   good idea, changed it
   



-- 
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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a diff in pull request #1458: MINIFICPP-1991 - Remove unused ControllerServiceProvider methods

2023-01-05 Thread GitBox


adamdebreceni commented on code in PR #1458:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1458#discussion_r1062424442


##
libminifi/include/core/controller/StandardControllerServiceProvider.h:
##
@@ -97,22 +73,15 @@ class StandardControllerServiceProvider : public 
ControllerServiceProvider, publ
 return new_service_node;
   }
 
-  std::future 
enableControllerService(std::shared_ptr ) {
-if (serviceNode->canEnable()) {
-  return agent_->enableControllerService(serviceNode);
-} else {
-  std::future no_run = 
std::async(std::launch::deferred, utils::TaskRescheduleInfo::Done);
-  return no_run;
-}
-  }
-
   virtual void enableAllControllerServices() {
 logger_->log_info("Enabling %u controller services", 
controller_map_->getAllControllerServices().size());
 for (auto service : controller_map_->getAllControllerServices()) {
-  if (service->canEnable()) {
-logger_->log_info("Enabling %s", service->getName());
-agent_->enableControllerService(service);
-  } else {
+  logger_->log_info("Enabling %s", service->getName());
+  if (!service->canEnable()) {
+logger_->log_warn("Service %s can not be enabled", service->getName());

Review Comment:
   changed



-- 
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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a diff in pull request #1458: MINIFICPP-1991 - Remove unused ControllerServiceProvider methods

2023-01-05 Thread GitBox


adamdebreceni commented on code in PR #1458:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1458#discussion_r1062424248


##
libminifi/include/FlowController.h:
##
@@ -225,11 +225,11 @@ class FlowController : public 
core::controller::ForwardingControllerServiceProvi
   // Whether it has already been initialized (load the flow XML already)
   std::atomic initialized_;
   // Flow Timer Scheduler

Review Comment:
   removed some comments that didn't seem very useful



-- 
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