adam-markovics commented on a change in pull request #1252:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1252#discussion_r816093101



##########
File path: extensions/rocksdb-repos/FlowFileRepository.h
##########
@@ -75,24 +75,28 @@ class FlowFileRepository : public core::Repository, public 
std::enable_shared_fr
                      int64_t maxPartitionBytes = 
MAX_FLOWFILE_REPOSITORY_STORAGE_SIZE,
                      std::chrono::milliseconds purgePeriod = 
FLOWFILE_REPOSITORY_PURGE_PERIOD)
       : core::SerializableComponent(repo_name),
-        Repository(repo_name.length() > 0 ? repo_name : 
core::getClassName<FlowFileRepository>(), directory, maxPartitionMillis, 
maxPartitionBytes, purgePeriod),
-        checkpoint_dir_(checkpoint_dir),
+        Repository(repo_name.length() > 0 ? repo_name : 
core::getClassName<FlowFileRepository>(), std::move(directory), 
maxPartitionMillis, maxPartitionBytes, purgePeriod),
+        checkpoint_dir_(std::move(checkpoint_dir)),
         content_repo_(nullptr),
         checkpoint_(nullptr),
         logger_(logging::LoggerFactory<FlowFileRepository>::getLogger()) {
-    db_ = NULL;
+    db_ = nullptr;
   }
 
-  virtual bool isNoop() {
+  ~FlowFileRepository() override {
+    stop();
+  }

Review comment:
       Base class thread member started with derived methods is a bad idea IMO. 
If it must be done, then we need to be careful to call stop in every future 
derived class destructor where this is done. Very error-prone.

##########
File path: extensions/script/python/PythonProcessor.h
##########
@@ -36,25 +36,16 @@ namespace py = pybind11;
  */
 class PythonProcessor {
  public:
-  explicit PythonProcessor(std::shared_ptr<core::Processor> proc);
+  explicit PythonProcessor(core::Processor* proc);
 
   void setSupportsDynamicProperties();
 
   void setDecription(const std::string &desc);
 
   void addProperty(const std::string &name, const std::string &description, 
const std::string &defaultvalue, bool required, bool el);
-  /**
-   * Sometimes we want to release shared pointers to core resources when
-   * we know they are no longer in need. This method is for those times.
-   *
-   * For example, we do not want to hold on to shared pointers to FlowFiles
-   * after an onTrigger call, because doing so can be very expensive in terms
-   * of repository resources.
-   */
-  void releaseCoreResources();
 
  private:
-  std::shared_ptr<core::Processor> processor_;
+  core::Processor* processor_;

Review comment:
       Done.

##########
File path: extensions/script/python/PythonProcessor.cpp
##########
@@ -32,33 +32,30 @@ namespace python {
 namespace py = pybind11;
 namespace core = org::apache::nifi::minifi::core;
 
-PythonProcessor::PythonProcessor(std::shared_ptr<core::Processor> proc) {
-  processor_ = 
std::dynamic_pointer_cast<python::processors::ExecutePythonProcessor>(proc);
+PythonProcessor::PythonProcessor(core::Processor* proc) {
+  processor_ = dynamic_cast<python::processors::ExecutePythonProcessor*>(proc);
 }
 
 void PythonProcessor::setSupportsDynamicProperties() {
   if (!processor_) {
     throw std::runtime_error("Access of Processor after it has been released");
   }

Review comment:
       Done.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to