data: indexer processes
* TaskBuildIndex starts seperate indexer processes and communicates via shared memory * indexer processes get restarted if they fail * indexer processes are killed when the app closes or crashes * added utility class SharedMemory to allocate and access shared memory, providing basic data structures * added SharedMemoryGarbageCollector for keeping track of running instances and cleaning up shared memory in case of a crash * show errors for source files that crashed during indexing * added basic exception handling to task scheduling * added option to turn off processes and use threads in preferences, but still use shared memory fortune cookie message = Good news from someone dear is coming soon.
This commit is contained in:
@@ -9,12 +9,46 @@
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
std::string JavaParser::prepareJavaEnvironment()
|
||||
{
|
||||
std::string errorString;
|
||||
|
||||
if (!JavaEnvironmentFactory::getInstance())
|
||||
{
|
||||
#ifdef _WIN32
|
||||
const std::string separator = ";";
|
||||
#else
|
||||
const std::string separator = ":";
|
||||
#endif
|
||||
JavaEnvironmentFactory::createInstance(
|
||||
ResourcePaths::getJavaPath().str() + "guava-18.0.jar" + separator +
|
||||
ResourcePaths::getJavaPath().str() + "java-indexer.jar" + separator +
|
||||
ResourcePaths::getJavaPath().str() + "javaparser-core.jar" + separator +
|
||||
ResourcePaths::getJavaPath().str() + "javaslang-2.0.3.jar" + separator +
|
||||
ResourcePaths::getJavaPath().str() + "javassist-3.19.0-GA.jar" + separator +
|
||||
ResourcePaths::getJavaPath().str() + "java-symbol-solver-core.jar" + separator +
|
||||
ResourcePaths::getJavaPath().str() + "java-symbol-solver-logic.jar" + separator +
|
||||
ResourcePaths::getJavaPath().str() + "java-symbol-solver-model.jar",
|
||||
errorString
|
||||
);
|
||||
}
|
||||
|
||||
return errorString;
|
||||
}
|
||||
|
||||
JavaParser::JavaParser(std::shared_ptr<ParserClient> client, std::shared_ptr<FileRegister> fileRegister)
|
||||
: Parser(client)
|
||||
, m_id(s_nextParserId++)
|
||||
{
|
||||
const std::string errorString = prepareJavaEnvironment();
|
||||
if (errorString.size() > 0)
|
||||
{
|
||||
LOG_ERROR(errorString);
|
||||
}
|
||||
|
||||
std::shared_ptr<JavaEnvironmentFactory> factory = JavaEnvironmentFactory::getInstance();
|
||||
if (factory)
|
||||
{
|
||||
@@ -63,7 +97,10 @@ void JavaParser::buildIndex(const FilePath& filePath, std::shared_ptr<TextAccess
|
||||
buildIndex(filePath, "", textAccess);
|
||||
}
|
||||
|
||||
void JavaParser::buildIndex(const FilePath& sourceFilePath, const std::string& classPath, std::shared_ptr<TextAccess> textAccess)
|
||||
void JavaParser::buildIndex(
|
||||
const FilePath& sourceFilePath,
|
||||
const std::string& classPath,
|
||||
std::shared_ptr<TextAccess> textAccess)
|
||||
{
|
||||
if (m_javaEnvironment)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,9 @@ class FileRegister;
|
||||
class JavaParser: public Parser
|
||||
{
|
||||
public:
|
||||
// returns: error message
|
||||
static std::string prepareJavaEnvironment();
|
||||
|
||||
JavaParser(std::shared_ptr<ParserClient> client, std::shared_ptr<FileRegister> fileRegister);
|
||||
~JavaParser();
|
||||
|
||||
@@ -38,7 +41,8 @@ public:
|
||||
void buildIndex(const FilePath& filePath, std::shared_ptr<TextAccess> textAccess);
|
||||
|
||||
private:
|
||||
void buildIndex(const FilePath& sourceFilePath, const std::string& classPath, std::shared_ptr<TextAccess> textAccess);
|
||||
void buildIndex(
|
||||
const FilePath& sourceFilePath, const std::string& classPath, std::shared_ptr<TextAccess> textAccess);
|
||||
|
||||
// This macro makes available a variable T, the passed-in t. blablabla TODO: write somethign real here
|
||||
#define MAKE_PARAMS_0()
|
||||
|
||||
Reference in New Issue
Block a user