| 214 | } |
| 215 | |
| 216 | void ProcessGroup::stopProcessing(const std::shared_ptr<TimerDrivenSchedulingAgent>& timeScheduler, const std::shared_ptr<EventDrivenSchedulingAgent> &eventScheduler, |
| 217 | const std::shared_ptr<CronDrivenSchedulingAgent> &cronScheduler, const std::function<bool(const std::shared_ptr<Processor>&)>& filter) { |
| 218 | std::lock_guard<std::recursive_mutex> lock(mutex_); |
| 219 | |
| 220 | if (onScheduleTimer_) { |
| 221 | onScheduleTimer_->stop(); |
| 222 | } |
| 223 | |
| 224 | onScheduleTimer_.reset(); |
| 225 | |
| 226 | try { |
| 227 | // Stop all the processor node, input and output ports |
| 228 | for (const auto &processor : processors_) { |
| 229 | if (!filter(processor)) { |
| 230 | continue; |
| 231 | } |
| 232 | logger_->log_debug("Stopping %s", processor->getName()); |
| 233 | switch (processor->getSchedulingStrategy()) { |
| 234 | case TIMER_DRIVEN: |
| 235 | timeScheduler->unschedule(processor); |
| 236 | break; |
| 237 | case EVENT_DRIVEN: |
| 238 | eventScheduler->unschedule(processor); |
| 239 | break; |
| 240 | case CRON_DRIVEN: |
| 241 | cronScheduler->unschedule(processor); |
| 242 | break; |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | for (ProcessGroup* childGroup : child_process_groups_) { |
| 247 | childGroup->stopProcessing(timeScheduler, eventScheduler, cronScheduler, filter); |
| 248 | } |
| 249 | } catch (std::exception &exception) { |
| 250 | logger_->log_debug("Caught Exception %s", exception.what()); |
| 251 | throw; |
| 252 | } catch (...) { |
| 253 | logger_->log_debug("Caught Exception during process group stop processing"); |
| 254 | throw; |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | std::shared_ptr<Processor> ProcessGroup::findProcessorById(const utils::Identifier& uuid) const { |
| 259 | const auto id_matches = [&] (const std::shared_ptr<Processor>& processor) { |
no test coverage detected