Technoboy- commented on a change in pull request #1645: fix zkMonitor bug
URL:
https://github.com/apache/incubator-dolphinscheduler/pull/1645#discussion_r362135266
##########
File path:
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/MonitorService.java
##########
@@ -116,20 +118,9 @@
}
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;
+
+ ZKNodeType zkNodeType = isMaster ? ZKNodeType.MASTER : ZKNodeType.WORKER;
+ return checkNotNull(zookeeperMonitor).getServersList(zkNodeType);
Review comment:
Not build pattern, so do not use like this
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services