use of com.vip.saturn.job.console.domain.ZkCluster in project Saturn by vipshop.
the class DashboardController method domainProcessCount.
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping(value = "/domainProcessCount")
public SuccessResponseEntity domainProcessCount(@RequestParam(required = false) String zkClusterKey) throws SaturnJobConsoleException {
if (StringUtils.isNotBlank(zkClusterKey)) {
ZkCluster zkCluster = checkAndGetZkCluster(zkClusterKey);
SaturnStatistics ss = dashboardService.allProcessAndErrorCountOfTheDay(zkCluster.getZkAddr());
return ss == null ? new SuccessResponseEntity() : new SuccessResponseEntity(ss.getResult());
}
return new SuccessResponseEntity(dashboardService.allProcessAndErrorCountOfTheDayByAllZkCluster());
}
use of com.vip.saturn.job.console.domain.ZkCluster in project Saturn by vipshop.
the class UtilsController method getZkClusterKeys.
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping(value = "/zkClusterKeys")
public SuccessResponseEntity getZkClusterKeys() {
Collection<ZkCluster> zkClusters = registryCenterService.getZkClusterList();
List<String> zkClusterKeys = Lists.newArrayList();
for (ZkCluster zkCluster : zkClusters) {
zkClusterKeys.add(zkCluster.getZkClusterKey());
}
return new SuccessResponseEntity(zkClusterKeys);
}
use of com.vip.saturn.job.console.domain.ZkCluster in project Saturn by vipshop.
the class AbstractController method getCurrentZkAddr.
/**
* @deprecated session do not store zk cluster information
*/
@Deprecated
public String getCurrentZkAddr(final HttpSession session) {
String zkClusterKey = (String) session.getAttribute(SessionAttributeKeys.CURRENT_ZK_CLUSTER_KEY);
if (zkClusterKey != null) {
ZkCluster zkCluster = registryCenterService.getZkCluster(zkClusterKey);
if (zkCluster != null) {
return zkCluster.getZkAddr();
}
}
// if zkClusterKey doesn't exist in map, use the first online one in map.
Collection<ZkCluster> zks = registryCenterService.getZkClusterList();
for (ZkCluster tmp : zks) {
ZkCluster zkCluster = tmp;
if (!zkCluster.isOffline()) {
setCurrentZkClusterKey(zkCluster.getZkClusterKey(), session);
return zkCluster.getZkClusterKey();
}
}
return null;
}
use of com.vip.saturn.job.console.domain.ZkCluster in project Saturn by vipshop.
the class RegistryCenterServiceImpl method closeInvalidZkClient.
private void closeInvalidZkClient(Map<String, ZkCluster> newClusterMap) {
Iterator<Entry<String, ZkCluster>> iterator = zkClusterMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, ZkCluster> next = iterator.next();
String zkClusterKey = next.getKey();
ZkCluster zkCluster = next.getValue();
if (!newClusterMap.containsKey(zkClusterKey)) {
iterator.remove();
closeZkCluster(zkCluster);
} else {
ZkCluster newZkCluster = newClusterMap.get(zkClusterKey);
if (zkCluster.equals(newZkCluster)) {
newClusterMap.put(zkClusterKey, zkCluster);
} else if (zkCluster.equalsNoNeedReconnect(newZkCluster)) {
zkCluster.setDescription(newZkCluster.getDescription());
newClusterMap.put(zkClusterKey, zkCluster);
} else {
iterator.remove();
closeZkCluster(zkCluster);
}
}
}
}
use of com.vip.saturn.job.console.domain.ZkCluster in project Saturn by vipshop.
the class RegistryCenterServiceImpl method getZkClusterKeys.
private List<String> getZkClusterKeys() {
Collection<ZkCluster> zkClusters = getZkClusterList();
List<String> zkClusterKeys = Lists.newArrayList();
for (ZkCluster zkCluster : zkClusters) {
zkClusterKeys.add(zkCluster.getZkClusterKey());
}
return zkClusterKeys;
}
Aggregations