aboutsummaryrefslogtreecommitdiffstats
path: root/staging_vespalib/src/vespa/vespalib/net/simple_health_producer.cpp
blob: 5c3aea96c8b6ab9a83919f3e178c7dedd31778dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "simple_health_producer.h"

namespace vespalib {

SimpleHealthProducer::SimpleHealthProducer()
    : _lock(),
      _health(true, "")
{
    setOk();
}

SimpleHealthProducer::~SimpleHealthProducer()
{
}

void
SimpleHealthProducer::setOk()
{
    LockGuard guard(_lock);
    _health = Health(true, "All OK");
}

void
SimpleHealthProducer::setFailed(const vespalib::string &msg)
{
    LockGuard guard(_lock);
    _health = Health(false, msg);
}

HealthProducer::Health
SimpleHealthProducer::getHealth() const
{
    LockGuard guard(_lock);
    return _health;
}

} // namespace vespalib