Constructor ! * Create a new scheduling agent. */
| 60 | * Create a new scheduling agent. |
| 61 | */ |
| 62 | SchedulingAgent(const gsl::not_null<core::controller::ControllerServiceProvider*> controller_service_provider, std::shared_ptr<core::Repository> repo, std::shared_ptr<core::Repository> flow_repo, |
| 63 | std::shared_ptr<core::ContentRepository> content_repo, std::shared_ptr<Configure> configuration, utils::ThreadPool<utils::TaskRescheduleInfo> &thread_pool) |
| 64 | : admin_yield_duration_(), |
| 65 | bored_yield_duration_(0), |
| 66 | configure_(configuration), |
| 67 | content_repo_(content_repo), |
| 68 | thread_pool_(thread_pool), |
| 69 | controller_service_provider_(controller_service_provider), |
| 70 | logger_(logging::LoggerFactory<SchedulingAgent>::getLogger()), |
| 71 | alert_time_(configuration->getInt(Configure::nifi_flow_engine_alert_period, SCHEDULING_WATCHDOG_DEFAULT_ALERT_PERIOD_MS)) { |
| 72 | running_ = false; |
| 73 | repo_ = repo; |
| 74 | flow_repo_ = flow_repo; |
| 75 | |
| 76 | if (alert_time_ > std::chrono::milliseconds(0)) { |
| 77 | std::function<void(void)> f = std::bind(&SchedulingAgent::watchDogFunc, this); |
| 78 | watchDogTimer_.reset(new utils::CallBackTimer(std::chrono::milliseconds(SCHEDULING_WATCHDOG_CHECK_PERIOD_MS), f)); |
| 79 | watchDogTimer_->start(); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | virtual ~SchedulingAgent() { |
| 84 | // Do NOT remove this! |