Search in sources :

Example 1 with SharedHealthState

use of org.sonar.process.cluster.health.SharedHealthState in project sonarqube by SonarSource.

the class HealthCheckerImpl method checkCluster.

@Override
public ClusterHealth checkCluster() {
    checkState(!webServer.isStandalone(), "Clustering is not enabled");
    checkState(sharedHealthState != null, "HealthState instance can't be null when clustering is enabled");
    Set<NodeHealth> nodeHealths = sharedHealthState.readAll();
    Health health = clusterHealthChecks.stream().map(clusterHealthCheck -> clusterHealthCheck.check(nodeHealths)).reduce(Health.GREEN, HealthReducer.INSTANCE);
    return new ClusterHealth(health, nodeHealths);
}
Also used : List(java.util.List) SharedHealthState(org.sonar.process.cluster.health.SharedHealthState) WebServer(org.sonar.server.platform.WebServer) NodeHealth(org.sonar.process.cluster.health.NodeHealth) Set(java.util.Set) Autowired(org.springframework.beans.factory.annotation.Autowired) ImmutableList.copyOf(com.google.common.collect.ImmutableList.copyOf) CheckForNull(javax.annotation.CheckForNull) Nullable(javax.annotation.Nullable) Preconditions.checkState(com.google.common.base.Preconditions.checkState) NodeHealth(org.sonar.process.cluster.health.NodeHealth) NodeHealth(org.sonar.process.cluster.health.NodeHealth)

Aggregations

Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 ImmutableList.copyOf (com.google.common.collect.ImmutableList.copyOf)1 List (java.util.List)1 Set (java.util.Set)1 CheckForNull (javax.annotation.CheckForNull)1 Nullable (javax.annotation.Nullable)1 NodeHealth (org.sonar.process.cluster.health.NodeHealth)1 SharedHealthState (org.sonar.process.cluster.health.SharedHealthState)1 WebServer (org.sonar.server.platform.WebServer)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1