| 60 | } |
| 61 | |
| 62 | std::future<utils::TaskRescheduleInfo> SchedulingAgent::disableControllerService(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) { |
| 63 | logger_->log_info("Disabling CSN in SchedulingAgent %s", serviceNode->getName()); |
| 64 | // reference the disable function from serviceNode |
| 65 | std::function<utils::TaskRescheduleInfo()> f_ex = [serviceNode] { |
| 66 | serviceNode->disable(); |
| 67 | return utils::TaskRescheduleInfo::Done(); |
| 68 | }; |
| 69 | |
| 70 | // only need to run this once. |
| 71 | auto monitor = utils::make_unique<utils::ComplexMonitor>(); |
| 72 | utils::Worker<utils::TaskRescheduleInfo> functor(f_ex, serviceNode->getUUIDStr(), std::move(monitor)); |
| 73 | |
| 74 | // move the functor into the thread pool. While a future is returned |
| 75 | // we aren't terribly concerned with the result. |
| 76 | std::future<utils::TaskRescheduleInfo> future; |
| 77 | thread_pool_.execute(std::move(functor), future); |
| 78 | if (future.valid()) |
| 79 | future.wait(); |
| 80 | return future; |
| 81 | } |
| 82 | |
| 83 | bool SchedulingAgent::hasTooMuchOutGoing(const std::shared_ptr<core::Processor>& processor) { |
| 84 | return processor->flowFilesOutGoingFull(); |