summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-02-10 11:43:24 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-02-10 11:43:24 +0000
commit92de2153fd8a37b2a63ba14ab9b76a4b34ce1be3 (patch)
treeab135770e1e3d5c201ef42aa2d20ca2fd200f505 /searchcore
parent075ad25176380a89ce1bd80a86ec8626de903586 (diff)
Catch and exit nicely on config error.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/apps/proton/proton.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/searchcore/src/apps/proton/proton.cpp b/searchcore/src/apps/proton/proton.cpp
index f80558a1bc6..8f2be3257fc 100644
--- a/searchcore/src/apps/proton/proton.cpp
+++ b/searchcore/src/apps/proton/proton.cpp
@@ -8,7 +8,6 @@
#include <vespa/metrics/metricmanager.h>
#include <vespa/vespalib/util/signalhandler.h>
#include <vespa/vespalib/util/programoptions.h>
-#include <vespa/vespalib/util/time.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/config/common/exceptions.h>
#include <vespa/fastos/app.h>
@@ -25,15 +24,21 @@ struct Params
std::string identity;
std::string serviceidentity;
uint64_t subscribeTimeout;
+ Params();
~Params();
};
+Params::Params()
+ : identity(),
+ serviceidentity(),
+ subscribeTimeout(60)
+{}
Params::~Params() = default;
class App : public FastOS_Application
{
private:
- void setupSignals();
+ static void setupSignals();
Params parseParams();
public:
int Main() override;
@@ -73,7 +78,7 @@ App::parseParams()
vespalib::ProgramOptions parser(_argc, _argv);
parser.setSyntaxMessage("proton -- the nextgen search core");
parser.addOption("identity", params.identity, "Node identity and config id");
- std::string empty("");
+ std::string empty;
parser.addOption("serviceidentity", params.serviceidentity, empty, "Service node identity and config id");
parser.addOption("subscribeTimeout", params.subscribeTimeout, UINT64_C(600000), "Initial config subscribe timeout");
try {
@@ -102,7 +107,7 @@ public:
ProtonServiceLayerProcess(const config::ConfigUri & configUri,
proton::Proton & proton,
PersistenceProvider *downPersistence);
- ~ProtonServiceLayerProcess() { shutdown(); }
+ ~ProtonServiceLayerProcess() override { shutdown(); }
void shutdown() override;
void setupProvider() override;
@@ -126,7 +131,7 @@ ProtonServiceLayerProcess::ProtonServiceLayerProcess(const config::ConfigUri &
downPersistence)
: ServiceLayerProcess(configUri),
_proton(proton),
- _metricManager(0),
+ _metricManager(nullptr),
_downPersistence(downPersistence)
{
if (!downPersistence) {
@@ -143,7 +148,7 @@ ProtonServiceLayerProcess::shutdown()
void
ProtonServiceLayerProcess::setupProvider()
{
- if (_metricManager != 0) {
+ if (_metricManager != nullptr) {
_context.getComponentRegister().setMetricManager(*_metricManager);
}
}
@@ -270,6 +275,9 @@ App::Main()
} catch (const vespalib::NetworkSetupFailureException & e) {
LOG(warning, "Network failure: '%s'", e.what());
return 1;
+ } catch (const config::InvalidConfigException & e) {
+ LOG(warning, "Invalid config failure: '%s'", e.what());
+ return 1;
} catch (const vespalib::IllegalStateException & e) {
LOG(error, "Unknown IllegalStateException: '%s'", e.what());
throw;