Search in sources :

Example 11 with JobNodePath

use of com.dangdang.ddframe.job.lite.internal.storage.JobNodePath in project elastic-job by dangdangdotcom.

the class ServerStatisticsAPIImpl method getJobs.

@Override
public Collection<ServerInfo> getJobs(final String serverIp) {
    List<String> jobs = regCenter.getChildrenKeys("/");
    Collection<ServerInfo> result = new ArrayList<>(jobs.size());
    for (String each : jobs) {
        JobNodePath jobNodePath = new JobNodePath(each);
        if (regCenter.isExisted(jobNodePath.getServerNodePath(serverIp))) {
            result.add(getJob(serverIp, each));
        }
    }
    return result;
}
Also used : ServerInfo(com.dangdang.ddframe.job.lite.lifecycle.domain.ServerInfo) ArrayList(java.util.ArrayList) JobNodePath(com.dangdang.ddframe.job.lite.internal.storage.JobNodePath)

Example 12 with JobNodePath

use of com.dangdang.ddframe.job.lite.internal.storage.JobNodePath in project elastic-job by dangdangdotcom.

the class JobStatisticsAPIImpl method getExecutionInfo.

@Override
public Collection<ExecutionInfo> getExecutionInfo(final String jobName) {
    String executionRootPath = new JobNodePath(jobName).getExecutionNodePath();
    if (!regCenter.isExisted(executionRootPath)) {
        return Collections.emptyList();
    }
    List<String> items = regCenter.getChildrenKeys(executionRootPath);
    List<ExecutionInfo> result = new ArrayList<>(items.size());
    for (String each : items) {
        result.add(getExecutionInfo(jobName, each));
    }
    Collections.sort(result);
    return result;
}
Also used : ArrayList(java.util.ArrayList) ExecutionInfo(com.dangdang.ddframe.job.lite.lifecycle.domain.ExecutionInfo) JobNodePath(com.dangdang.ddframe.job.lite.internal.storage.JobNodePath)

Aggregations

JobNodePath (com.dangdang.ddframe.job.lite.internal.storage.JobNodePath)12 ArrayList (java.util.ArrayList)5 ServerInfo (com.dangdang.ddframe.job.lite.lifecycle.domain.ServerInfo)4 LiteJobConfiguration (com.dangdang.ddframe.job.lite.config.LiteJobConfiguration)2 ExecutionInfo (com.dangdang.ddframe.job.lite.lifecycle.domain.ExecutionInfo)1 JobBriefInfo (com.dangdang.ddframe.job.lite.lifecycle.domain.JobBriefInfo)1 JobSettings (com.dangdang.ddframe.job.lite.lifecycle.domain.JobSettings)1 ServerBriefInfo (com.dangdang.ddframe.job.lite.lifecycle.domain.ServerBriefInfo)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1