All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.vespa.hosted.controller.maintenance.OsVersionStatusUpdater Maven / Gradle / Ivy

There is a newer version: 8.253.3
Show newest version
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.maintenance;

import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.versions.OsVersionStatus;
import com.yahoo.yolean.Exceptions;

import java.time.Duration;
import java.util.logging.Level;

/**
 * @author mpolden
 */
public class OsVersionStatusUpdater extends ControllerMaintainer {

    public OsVersionStatusUpdater(Controller controller, Duration interval) {
        super(controller, interval);
    }

    @Override
    protected double maintain() {
        try {
            OsVersionStatus newStatus = OsVersionStatus.compute(controller());
            controller().updateOsVersionStatus(newStatus);
            return 1.0;
        } catch (Exception e) {
            log.log(Level.WARNING, "Failed to compute OS version status: " + Exceptions.toMessageString(e) +
                                   ". Retrying in " + interval());
        }
        return 0.0;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy