MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / onEnable

Method onEnable

libminifi/src/controllers/NetworkPrioritizerService.cpp:191–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191void NetworkPrioritizerService::onEnable() {
192 std::string controllers;
193 if (getProperty(NetworkControllers.getName(), controllers) || !linked_services_.empty()) {
194 // if this controller service is defined, it will be an intersection of this config with linked services.
195 if (getProperty(MaxThroughput.getName(), max_throughput_)) {
196 logger_->log_trace("Max throughput is %d", max_throughput_);
197 if (max_throughput_ < 1000) {
198 bytes_per_token_ = 1;
199 tokens_ = gsl::narrow<uint32_t>(max_throughput_);
200 } else {
201 bytes_per_token_ = gsl::narrow<uint32_t>(max_throughput_ / 1000);
202 }
203 }
204
205 getProperty(MaxPayload.getName(), max_payload_);
206
207 if (!controllers.empty()) {
208 network_controllers_ = utils::StringUtils::split(controllers, ",");
209 for (const auto &ifc : network_controllers_) {
210 logger_->log_trace("%s added to list of applied interfaces", ifc);
211 }
212 }
213 bool is_default = false;
214 if (getProperty(DefaultPrioritizer.getName(), is_default)) {
215 if (is_default) {
216 if (io::NetworkPrioritizerFactory::getInstance()->setPrioritizer(shared_from_this()) < 0) {
217 std::runtime_error("Can only have one prioritizer");
218 }
219 }
220 }
221 getProperty(VerifyInterfaces.getName(), verify_interfaces_);
222 timestamp_ = clock_->timeSinceEpoch().count();
223 enabled_ = true;
224 logger_->log_trace("Enabled");
225 } else {
226 logger_->log_trace("Could not enable ");
227 }
228}
229} /* namespace controllers */
230} /* namespace minifi */
231} /* namespace nifi */

Callers

nothing calls this directly

Calls 5

log_traceMethod · 0.80
setPrioritizerMethod · 0.80
getNameMethod · 0.45
emptyMethod · 0.45
timeSinceEpochMethod · 0.45

Tested by

no test coverage detected