summaryrefslogtreecommitdiffstats
path: root/document/src
diff options
context:
space:
mode:
Diffstat (limited to 'document/src')
-rw-r--r--document/src/vespa/document/repo/document_type_repo_factory.cpp30
-rw-r--r--document/src/vespa/document/repo/document_type_repo_factory.h1
2 files changed, 30 insertions, 1 deletions
diff --git a/document/src/vespa/document/repo/document_type_repo_factory.cpp b/document/src/vespa/document/repo/document_type_repo_factory.cpp
index 8224d0f2c9a..ce8d19ae5a2 100644
--- a/document/src/vespa/document/repo/document_type_repo_factory.cpp
+++ b/document/src/vespa/document/repo/document_type_repo_factory.cpp
@@ -3,13 +3,35 @@
#include "document_type_repo_factory.h"
#include "documenttyperepo.h"
#include <vespa/document/config/config-documenttypes.h>
-#include <functional>
+#include <iostream>
+#include <stdexcept>
+
namespace document {
std::mutex DocumentTypeRepoFactory::_mutex;
DocumentTypeRepoFactory::DocumentTypeRepoMap DocumentTypeRepoFactory::_repos;
+namespace {
+
+class EmptyFactoryCheck
+{
+public:
+ ~EmptyFactoryCheck();
+};
+
+EmptyFactoryCheck::~EmptyFactoryCheck()
+{
+ if (!DocumentTypeRepoFactory::empty()) {
+ std::cerr << "DocumentTypeRepoFactory not empty at shutdown" << std::endl;
+ abort();
+ }
+}
+
+EmptyFactoryCheck emptyFactoryCheck;
+
+}
+
/*
* Class handling deletion of document type repo after last reference is gone.
*/
@@ -48,4 +70,10 @@ DocumentTypeRepoFactory::make(const DocumenttypesConfig &config)
return repo;
}
+bool
+DocumentTypeRepoFactory::empty()
+{
+ return _repos.empty();
+}
+
}
diff --git a/document/src/vespa/document/repo/document_type_repo_factory.h b/document/src/vespa/document/repo/document_type_repo_factory.h
index e104fe1f6a0..4bf65d61645 100644
--- a/document/src/vespa/document/repo/document_type_repo_factory.h
+++ b/document/src/vespa/document/repo/document_type_repo_factory.h
@@ -44,6 +44,7 @@ public:
* pointer to a const repo. The repo should be considered immutable.
*/
static std::shared_ptr<const DocumentTypeRepo> make(const DocumenttypesConfig &config);
+ static bool empty();
};
}