Authored by simba

update

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