问题描述
我有两个运行状况指示器,一个用于数据库,另一个用于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 (将#修改为@)