You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2019/09/04 14:04:10 UTC

[GitHub] [nifi-minifi-cpp] arpadboda commented on a change in pull request #636: Minificpp-780 - Change GenerateFlowFile to allow 0b content FlowFiles

arpadboda commented on a change in pull request #636: Minificpp-780 - Change GenerateFlowFile to allow 0b content FlowFiles
URL: https://github.com/apache/nifi-minifi-cpp/pull/636#discussion_r320777618
 
 

 ##########
 File path: extensions/standard-processors/processors/GenerateFlowFile.cpp
 ##########
 @@ -77,7 +73,28 @@ void GenerateFlowFile::initialize() {
   setSupportedRelationships(relationships);
 }
 
+void generateData(std::vector<char>& data, bool textData = false) {
+  std::random_device rd;
+  std::mt19937 eng(rd());
+  if (textData) {
+    std::uniform_int_distribution<> distr(0, TEXT_LEN);
+    auto rand = std::bind(distr, eng);
+    std::generate_n(data.begin(), data.size(), rand);
+    std::for_each(data.begin(), data.end(), [](char & c) { c = TEXT_CHARS[c];});
+  } else {
+    std::uniform_int_distribution<> distr(std::numeric_limits<char>::min(), std::numeric_limits<char>::max());
+    auto rand = std::bind(distr, eng);
+    std::generate_n(data.begin(), data.size(), rand);
+  }
+}
+
 void GenerateFlowFile::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
+  std::unique_lock<std::mutex> lock(onTriggerMutex_, std::try_to_lock);
+  if (!lock.owns_lock()) {
+    logger_->log_warn("processor was triggered before previous listing finished, configuration should be revised!");
 
 Review comment:
   Removed completely as it became needless. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services