如何为不同的HealthIndicators春季启动分别调用IsReadyToBeClosed

问题描述

我有两个运行状况指示器,一个用于数据库,另一个用于jms。在我的HalfOpenHandler中,我重写isReadyToBeClosed()以返回布尔值。我以前只有数据库,所以我的课看起来像这样:

public class RouteHalfOpenHandler implements ThrottlingExceptionHalfOpenHandler {

    private static HealthIndicator healthIndicator;

    public RouteHalfOpenHandler(final HealthIndicator healthIndicator) {
        this.healthIndicator = healthIndicator;
    }

    @Override
    public boolean isReadyToBeClosed() {
        return healthIndicator.health().getStatus().equals(Status.UP);
    }
}

但是现在我有两个健康指标,我将使用列表来保存类似以下内容的属性:

    private static List<HealthIndicator> healthIndicatorsList;

    public RouteHalfOpenHandler(final List<HealthIndicator> healthIndicatorsList) {
        this.healthIndicatorsList = healthIndicatorsList;
    }

然后,我应该如何实现isReadyToBeClosed()?有没有办法分别检查每个连接?还是这种方法去检查列表中的每个健康指标,如果其中一个功能不正常,应该返回false?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...