Browse Source

Merge pull request #1645 from clay4444/dev

fix zkMonitor bug
pull/2/head
Tboy 5 years ago committed by GitHub
parent
commit
ced4b10c1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/MonitorService.java

20
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/MonitorService.java

@ -33,6 +33,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.apache.dolphinscheduler.common.utils.Preconditions.*;
/**
* monitor service
*/
@ -116,20 +118,10 @@ public class MonitorService extends BaseService{
}
public List<Server> getServerListFromZK(boolean isMaster){
List<Server> servers = new ArrayList<>();
ZookeeperMonitor zookeeperMonitor = null;
try{
zookeeperMonitor = new ZookeeperMonitor();
ZKNodeType zkNodeType = isMaster ? ZKNodeType.MASTER : ZKNodeType.WORKER;
servers = zookeeperMonitor.getServersList(zkNodeType);
}catch (Exception e){
throw e;
}finally {
if(zookeeperMonitor != null){
zookeeperMonitor.close();
}
}
return servers;
checkNotNull(zookeeperMonitor);
ZKNodeType zkNodeType = isMaster ? ZKNodeType.MASTER : ZKNodeType.WORKER;
return zookeeperMonitor.getServersList(zkNodeType);
}
}

Loading…
Cancel
Save