Github user jdye64 commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/63#discussion_r105261283
--- Diff: libminifi/include/SchedulingAgent.h ---
@@ -28,72 +28,90 @@
#include <algorithm>
#include <thread>
#include "utils/TimeUtil.h"
-#include "Logger.h"
+#include "core/logging/Logger.h"
#include "Configure.h"
#include "FlowFileRecord.h"
-#include "Logger.h"
-#include "Processor.h"
-#include "ProcessContext.h"
+#include "core/logging/Logger.h"
+#include "core/Processor.h"
+#include "core/ProcessContext.h"
+
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+
//! SchedulingAgent Class
-class SchedulingAgent
-{
-public:
- //! Constructor
- /*!
- * Create a new processor
- */
- SchedulingAgent() {
- configure_ = Configure::getConfigure();
- logger_ = Logger::getLogger();
- _running = false;
- }
- //! Destructor
- virtual ~SchedulingAgent()
- {
+class SchedulingAgent {
+ public:
+ //! Constructor
+ /*!
+ * Create a new processor
+ */
+ SchedulingAgent(std::shared_ptr<provenance::ProvenanceRepository> repo) {
+ configure_ = Configure::getConfigure();
+ logger_ = logging::Logger::getLogger();
+ _running = false;
+ repo_ = repo;
+ }
+ //! Destructor
+ virtual ~SchedulingAgent() {
+
+ }
+ //! onTrigger, return whether the yield is need
+ bool onTrigger(
+ std::shared_ptr<core::Processor> processor,
+ core::ProcessContext *processContext,
+ core::ProcessSessionFactory *sessionFactory);
+ //! Whether agent has work to do
+ bool hasWorkToDo(std::shared_ptr<core::Processor> processor);
+ //! Whether the outgoing need to be backpressure
+ bool hasTooMuchOutGoing(
+ std::shared_ptr<core::Processor> processor);
+ //! start
+ void start() {
+ _running = true;
+ }
+ //! stop
+ void stop() {
+ _running = false;
+ }
- }
- //! onTrigger, return whether the yield is need
- bool onTrigger(Processor *processor, ProcessContext *processContext,
ProcessSessionFactory *sessionFactory);
- //! Whether agent has work to do
- bool hasWorkToDo(Processor *processor);
- //! Whether the outgoing need to be backpressure
- bool hasTooMuchOutGoing(Processor *processor);
- //! start
- void start() {
- _running = true;
- }
- //! stop
- void stop() {
- _running = false;
- }
+ public:
+ //! schedule, overwritten by different DrivenSchedulingAgent
+ virtual void schedule(
+ std::shared_ptr<core::Processor> processor) = 0;
+ //! unschedule, overwritten by different DrivenSchedulingAgent
+ virtual void unschedule(
+ std::shared_ptr<core::Processor> processor) = 0;
-public:
- //! schedule, overwritten by different DrivenSchedulingAgent
- virtual void schedule(Processor *processor) = 0;
- //! unschedule, overwritten by different DrivenSchedulingAgent
- virtual void unschedule(Processor *processor) = 0;
+ SchedulingAgent(const SchedulingAgent &parent) = delete;
+ SchedulingAgent &operator=(const SchedulingAgent &parent) = delete;
+ protected:
+ //! Logger
+ std::shared_ptr<logging::Logger> logger_;
+ //! Configure
+ Configure *configure_;
+ //! Mutex for protection
+ std::mutex _mtx;
+ //! Whether it is running
+ std::atomic<bool> _running;
+ //! AdministrativeYieldDuration
+ int64_t _administrativeYieldDuration;
+ //! BoredYieldDuration
+ int64_t _boredYieldDuration;
--- End diff --
Can you move "_" to end of class data member to adhere to Google C++ Style
guide? Same for all variables here.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---