Authored by simba

update

... ... @@ -3,14 +3,12 @@ package com.monitor.middleware.zookeeper.service.iml;
import com.monitor.influxdb.mapper.IZkMapper;
import com.monitor.influxdb.model.ZkInfo;
import com.monitor.middleware.zookeeper.service.IZkMonitorService;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooKeeper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
... ... @@ -55,7 +53,7 @@ public class ZkMonitorServiceImpl implements IZkMonitorService {
}
private int checkConnection(String ip) throws IOException, KeeperException, InterruptedException {
private int checkConnection(String ip) throws Exception{
ZooKeeper zk = new ZooKeeper("192.168.102.205:2181", 2000,null);
// 获取某路径下所有节点
List<String> children = zk.getChildren("/", false);
... ...
... ... @@ -18,7 +18,7 @@ public class ZookeeperMonitorTask {
@Autowired
IZkMonitorService zkMonitorService;
@Scheduled(fixedRate=5000)
@Scheduled(fixedRate=20000)
public void zookeeperMonitor() {
zkMonitorService.zookeeperMonitor();
}
... ...