adamdebreceni commented on a change in pull request #1191:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1191#discussion_r723189078



##########
File path: libminifi/src/core/Processor.cpp
##########
@@ -379,25 +379,37 @@ std::shared_ptr<Connectable> 
Processor::pickIncomingConnection() {
   return getNextIncomingConnectionImpl(rel_guard);
 }
 
-void Processor::validateAnnotations() const {
+void Processor::validateAnnotations() {
+  validateInputRequirements();
+  validateThreads();
+}
+
+void Processor::validateInputRequirements() const {
   switch (getInputRequirement()) {
     case annotation::Input::INPUT_REQUIRED: {
       if (!hasIncomingConnections()) {
         throw Exception(PROCESS_SCHEDULE_EXCEPTION, "INPUT_REQUIRED was 
specified for the processor, but no incoming connections were found");
       }
-      return;
+      break;
     }
     case annotation::Input::INPUT_ALLOWED:
-      return;
+      break;
     case annotation::Input::INPUT_FORBIDDEN: {
       if (hasIncomingConnections()) {
         throw Exception(PROCESS_SCHEDULE_EXCEPTION, "INPUT_FORBIDDEN was 
specified for the processor, but there are incoming connections");
       }
-      return;
     }
   }
 }
 
+void Processor::validateThreads() {
+  if (isSingleThreaded() && max_concurrent_tasks_ > 1) {
+    logger_->log_warn("Processor %s can not be run in parallel, its \"max 
concurrent tasks\" value is too high. "
+                      "It was set to 1 from %d.", name_, 
max_concurrent_tasks_);
+    max_concurrent_tasks_ = 1;

Review comment:
       I think we should move this warning and the fallback to 1 to 
`Processor::setMaxConcurrentTasks`, also there is a `setMaxConcurrentTasks` in 
Processor as well in Connectable, but it is not virtual, we should make it 
virtual and let the Processor override it




-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to