use of com.jeesuite.scheduler.model.JobGroupInfo in project jeesuite-libs by vakinge.
the class SchedulerMonitor method getAllJobGroups.
public List<JobGroupInfo> getAllJobGroups() {
// zk registry
List<JobGroupInfo> result = new ArrayList<>();
List<String> groupNames = getGroups();
if (groupNames == null)
return result;
for (String groupName : groupNames) {
JobGroupInfo groupInfo = getJobGroupInfo(groupName);
if (groupInfo != null) {
result.add(groupInfo);
}
}
return result;
}
use of com.jeesuite.scheduler.model.JobGroupInfo in project jeesuite-libs by vakinge.
the class SchedulerMonitor method getJobGroupInfo.
public JobGroupInfo getJobGroupInfo(String groupName) {
if (StringUtils.isBlank(groupName)) {
logger.warn("getJobGroupInfo groupName is required");
return null;
}
JobGroupInfo groupInfo = new JobGroupInfo();
groupInfo.setName(groupName);
//
String path = ZkJobRegistry.ROOT + groupName;
List<String> children = zkClient.getChildren(path);
for (String child : children) {
if ("nodes".equals(child)) {
path = ZkJobRegistry.ROOT + groupName + "/nodes";
groupInfo.setClusterNodes(zkClient.getChildren(path));
} else {
path = ZkJobRegistry.ROOT + groupName + "/" + child;
Object data = zkClient.readData(path);
if (data != null) {
JobConfig jobConfig = JsonUtils.toObject(data.toString(), JobConfig.class);
groupInfo.getJobs().add(jobConfig);
}
}
}
if (groupInfo.getClusterNodes().size() > 0) {
return groupInfo;
}
return null;
}
Aggregations