[
https://issues.apache.org/jira/browse/MINIFI-217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15903789#comment-15903789
]
ASF GitHub Bot commented on MINIFI-217:
---------------------------------------
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.
> Move to org::apache::nifi::minifi namespace in CPP agent
> --------------------------------------------------------
>
> Key: MINIFI-217
> URL: https://issues.apache.org/jira/browse/MINIFI-217
> Project: Apache NiFi MiNiFi
> Issue Type: Bug
> Components: C++
> Affects Versions: cpp-0.1.0, cpp-0.2.0
> Reporter: marco polo
> Priority: Trivial
> Original Estimate: 504h
> Remaining Estimate: 504h
>
> Move code to a more controlled namespace. I suggest org::apache::nifi::minifi
> since that more closely reflects the JAVA package.
> Suggest Processor namespace be
> org::apache::nifi::minifi::processors
> Suggest I/O namespace be
> org::apache::nifi::minifi::io
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)