use of com.jeesuite.scheduler.model.JobConfig in project jeesuite-libs by vakinge.
the class ZkJobRegistry method unregister.
@Override
public synchronized void unregister(String jobName) {
JobConfig config = schedulerConfgs.get(jobName);
String path = getPath(config);
if (zkClient.getChildren(nodeStateParentPath).size() == 1) {
zkClient.delete(path);
logger.info("all node is closed ,delete path:" + path);
}
}
use of com.jeesuite.scheduler.model.JobConfig in project jeesuite-libs by vakinge.
the class ZkJobRegistry method rebalanceJobNode.
/**
* 重新分配执行节点
* @param nodes
*/
private synchronized void rebalanceJobNode(List<String> nodes) {
while (updatingStatus) ;
Collection<JobConfig> jobs = schedulerConfgs.values();
int nodeIndex = 0;
for (JobConfig job : jobs) {
String nodeId = nodes.get(nodeIndex++);
if (!StringUtils.equals(job.getCurrentNodeId(), nodeId)) {
job.setCurrentNodeId(nodeId);
logger.info("rebalance Job[{}-{}] To Node[{}] ", job.getGroupName(), job.getJobName(), nodeId);
}
if (nodeIndex >= nodes.size()) {
nodeIndex = 0;
}
//
updateJobConfig(job);
}
}
Aggregations