mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 11:52:08 +08:00
@@ -67,4 +67,8 @@ public interface BrokerService {
|
||||
* 获取总的Broker数
|
||||
*/
|
||||
Integer countAllBrokers();
|
||||
|
||||
boolean allServerDown(Long clusterPhyId);
|
||||
|
||||
boolean existServerDown(Long clusterPhyId);
|
||||
}
|
||||
|
||||
@@ -262,14 +262,32 @@ public class BrokerServiceImpl extends BaseVersionControlService implements Brok
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Integer countAllBrokers() {
|
||||
LambdaQueryWrapper<BrokerPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
return brokerDAO.selectCount(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allServerDown(Long clusterPhyId) {
|
||||
List<BrokerPO> poList = this.getAllBrokerPOsFromDB(clusterPhyId);
|
||||
if (ValidateUtils.isEmptyList(poList)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return poList.stream().filter(elem -> elem.getStatus().equals(Constant.DOWN)).count() == poList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existServerDown(Long clusterPhyId) {
|
||||
List<BrokerPO> poList = this.getAllBrokerPOsFromDB(clusterPhyId);
|
||||
if (ValidateUtils.isEmptyList(poList)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return poList.stream().filter(elem -> elem.getStatus().equals(Constant.DOWN)).count() > 0;
|
||||
}
|
||||
|
||||
/**************************************************** private method ****************************************************/
|
||||
|
||||
private List<Broker> listAllBrokersAndUpdateCache(Long clusterPhyId) {
|
||||
|
||||
Reference in New Issue
Block a user