logic: Fixed bugs in TaskParse scheduling
* Added TaskParse as base for TaskParseCxx and TaskParseJava * Fixed increment and decrement of indexer_count on blackboard not atomic * Fixed TaskInjectStorage finished before TaskParse started * Fixed project not cleared when refreshing on now empty project * Fixed TaskInjectStorage overheating when nothing to do
This commit is contained in:
@@ -5,10 +5,7 @@
|
||||
#include "data/parser/ParserClientImpl.h"
|
||||
#include "data/StorageProvider.h"
|
||||
#include "utility/file/FileRegister.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
#include "utility/scheduling/Blackboard.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
TaskParseJava::TaskParseJava(
|
||||
std::shared_ptr<StorageProvider> storageProvider,
|
||||
@@ -16,24 +13,10 @@ TaskParseJava::TaskParseJava(
|
||||
const Parser::Arguments& arguments,
|
||||
DialogView* dialogView
|
||||
)
|
||||
: m_storageProvider(storageProvider)
|
||||
, m_fileRegister(fileRegister)
|
||||
, m_arguments(arguments)
|
||||
, m_dialogView(dialogView)
|
||||
, m_interrupted(false)
|
||||
: TaskParse(storageProvider, fileRegister, arguments, dialogView)
|
||||
{
|
||||
}
|
||||
|
||||
void TaskParseJava::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
int indexerCount = 0;
|
||||
if (blackboard->get("indexer_count", indexerCount))
|
||||
{
|
||||
indexerCount++;
|
||||
blackboard->set("indexer_count", indexerCount);
|
||||
}
|
||||
}
|
||||
|
||||
Task::TaskState TaskParseJava::doUpdate(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
std::shared_ptr<ParserClientImpl> parserClient = std::make_shared<ParserClientImpl>();
|
||||
@@ -69,22 +52,3 @@ Task::TaskState TaskParseJava::doUpdate(std::shared_ptr<Blackboard> blackboard)
|
||||
|
||||
return (m_interrupted ? STATE_FAILURE : STATE_SUCCESS);
|
||||
}
|
||||
|
||||
void TaskParseJava::doExit(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
int indexerCount = 0;
|
||||
if (blackboard->get("indexer_count", indexerCount))
|
||||
{
|
||||
indexerCount--;
|
||||
blackboard->set("indexer_count", indexerCount);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskParseJava::doReset(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
}
|
||||
|
||||
void TaskParseJava::handleMessage(MessageInterruptTasks* message)
|
||||
{
|
||||
m_interrupted = true;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,10 @@
|
||||
#ifndef TASK_PARSE_JAVA_H
|
||||
#define TASK_PARSE_JAVA_H
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include "data/parser/Parser.h"
|
||||
#include "utility/scheduling/Task.h"
|
||||
#include "utility/messaging/type/MessageInterruptTasks.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
|
||||
class DialogView;
|
||||
class FileRegister;
|
||||
class StorageProvider;
|
||||
#include "data/parser/TaskParse.h"
|
||||
|
||||
class TaskParseJava
|
||||
: public Task
|
||||
, public MessageListener<MessageInterruptTasks>
|
||||
: public TaskParse
|
||||
{
|
||||
public:
|
||||
TaskParseJava(
|
||||
@@ -25,19 +15,7 @@ public:
|
||||
);
|
||||
|
||||
private:
|
||||
virtual void doEnter(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual TaskState doUpdate(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual void doExit(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual void doReset(std::shared_ptr<Blackboard> blackboard);
|
||||
|
||||
virtual void handleMessage(MessageInterruptTasks* message);
|
||||
|
||||
std::shared_ptr<StorageProvider> m_storageProvider;
|
||||
std::shared_ptr<FileRegister> m_fileRegister;
|
||||
Parser::Arguments m_arguments;
|
||||
DialogView* m_dialogView;
|
||||
|
||||
bool m_interrupted;
|
||||
};
|
||||
|
||||
#endif // TASK_PARSE_JAVA_H
|
||||
|
||||
Reference in New Issue
Block a user