szaszm commented on a change in pull request #890:
URL: https://github.com/apache/nifi-minifi-cpp/pull/890#discussion_r484513034
##########
File path: libminifi/src/FlowController.cpp
##########
@@ -320,12 +320,12 @@ void FlowController::initializeUninitializedSchedulers() {
conditionalReloadScheduler<CronDrivenSchedulingAgent>(cron_scheduler_,
!cron_scheduler_);
}
-void FlowController::reinitializeSchedulersWithNewThreadPool() {
- using ControllerServiceProvider =
core::controller::ControllerServiceProvider;
+void FlowController::reinitializeSchedulersWithClearedThreadPool() {
+ using NonNullControllerServiceProviderPtr =
gsl::not_null<core::controller::ControllerServiceProvider*>;
restartThreadPool();
- timer_scheduler_ =
std::make_shared<TimerDrivenSchedulingAgent>(gsl::not_null<ControllerServiceProvider*>(this),
provenance_repo_, flow_file_repo_, content_repo_, configuration_,
thread_pool_);
- event_scheduler_ =
std::make_shared<EventDrivenSchedulingAgent>(gsl::not_null<ControllerServiceProvider*>(this),
provenance_repo_, flow_file_repo_, content_repo_, configuration_,
thread_pool_);
- cron_scheduler_ =
std::make_shared<CronDrivenSchedulingAgent>(gsl::not_null<ControllerServiceProvider*>(this),
provenance_repo_, flow_file_repo_, content_repo_, configuration_,
thread_pool_);
+ timer_scheduler_ =
std::make_shared<TimerDrivenSchedulingAgent>(NonNullControllerServiceProviderPtr(this),
provenance_repo_, flow_file_repo_, content_repo_, configuration_,
thread_pool_);
+ event_scheduler_ =
std::make_shared<EventDrivenSchedulingAgent>(NonNullControllerServiceProviderPtr(this),
provenance_repo_, flow_file_repo_, content_repo_, configuration_,
thread_pool_);
+ cron_scheduler_ =
std::make_shared<CronDrivenSchedulingAgent>(NonNullControllerServiceProviderPtr(this),
provenance_repo_, flow_file_repo_, content_repo_, configuration_,
thread_pool_);
Review comment:
Consider using `gsl::make_not_null` and relying on implicit conversion
to base class pointer.
```suggestion
timer_scheduler_ =
std::make_shared<TimerDrivenSchedulingAgent>(gsl::make_not_null(this),
provenance_repo_, flow_file_repo_, content_repo_, configuration_, thread_pool_);
event_scheduler_ =
std::make_shared<EventDrivenSchedulingAgent>(gsl::make_not_null(this),
provenance_repo_, flow_file_repo_, content_repo_, configuration_, thread_pool_);
cron_scheduler_ =
std::make_shared<CronDrivenSchedulingAgent>(gsl::make_not_null(this),
provenance_repo_, flow_file_repo_, content_repo_, configuration_, thread_pool_);
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]