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