From 6d93d8e708d9f8cf8866f04e786c78650c44bc6a Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Fri, 17 Jan 2020 16:23:27 -0500 Subject: [PATCH] removes deprecated class --- .../DiscoveryCompositeHealthIndicator.java | 89 ------------------- 1 file changed, 89 deletions(-) delete mode 100644 spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/health/DiscoveryCompositeHealthIndicator.java diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/health/DiscoveryCompositeHealthIndicator.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/health/DiscoveryCompositeHealthIndicator.java deleted file mode 100644 index 2e14caff..00000000 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/health/DiscoveryCompositeHealthIndicator.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2012-2019 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.client.discovery.health; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.actuate.health.CompositeHealthIndicator; -import org.springframework.boot.actuate.health.Health; -import org.springframework.boot.actuate.health.HealthAggregator; -import org.springframework.boot.actuate.health.HealthIndicator; - -/** - * Gathers all instances of DiscoveryHealthIndicator from a DiscoveryClient implementation - * and aggregates the statuses. - * - * @author Spencer Gibb - * @deprecated since 2.2.0 in favor of {@link DiscoveryCompositeHealthContributor} - */ -// TODO: do we need this? Can they just be independent HealthIndicators? -@Deprecated -public class DiscoveryCompositeHealthIndicator extends CompositeHealthIndicator { - - private final ArrayList healthIndicators = new ArrayList<>(); - - @Autowired - public DiscoveryCompositeHealthIndicator(HealthAggregator healthAggregator, - List indicators) { - super(healthAggregator, createMap(indicators)); - getRegistry().getAll().values().stream() - .filter(healthIndicator -> healthIndicator instanceof Holder) - .forEach(healthIndicator -> this.healthIndicators - .add((Holder) healthIndicator)); - } - - public ArrayList getHealthIndicators() { - return this.healthIndicators; - } - - public static Map createMap( - List indicators) { - Map map = new HashMap<>(); - for (DiscoveryHealthIndicator indicator : indicators) { - Holder holder = new Holder(indicator); - map.put(indicator.getName(), holder); - } - return map; - } - - /** - * Holder for the Health Indicator. - */ - public static class Holder implements HealthIndicator { - - private DiscoveryHealthIndicator delegate; - - public Holder(DiscoveryHealthIndicator delegate) { - this.delegate = delegate; - } - - @Override - public Health health() { - return this.delegate.health(); - } - - public DiscoveryHealthIndicator getDelegate() { - return this.delegate; - } - - } - -}