blob: 7a6494e0122b71716ca6ce453cbd3d03647ab7d7 (
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
|
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.service.health;
import com.yahoo.vespa.applicationmodel.ServiceStatusInfo;
import com.yahoo.vespa.service.executor.Cancellable;
import com.yahoo.vespa.service.executor.RunletExecutor;
import java.time.Duration;
/**
* Used to monitor the health of a single URL endpoint.
*
* @author hakon
*/
class StateV1HealthMonitor implements HealthMonitor {
private final StateV1HealthUpdater updater;
private final Cancellable periodicExecution;
StateV1HealthMonitor(StateV1HealthUpdater updater, RunletExecutor executor, Duration delay) {
this.updater = updater;
this.periodicExecution = executor.scheduleWithFixedDelay(updater, delay);
}
@Override
public ServiceStatusInfo getStatus() {
return updater.getServiceStatusInfo();
}
@Override
public void close() {
periodicExecution.cancel();
}
}
|