Search in sources :

Example 6 with ServerInfo

use of com.dangdang.ddframe.job.lite.lifecycle.domain.ServerInfo 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)

Aggregations

ServerInfo (com.dangdang.ddframe.job.lite.lifecycle.domain.ServerInfo)6 JobNodePath (com.dangdang.ddframe.job.lite.internal.storage.JobNodePath)4 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2