Authored by qinchao

zk比较

... ... @@ -97,7 +97,11 @@
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
... ...
... ... @@ -7,6 +7,7 @@ import com.monitor.model.page.PageResponse;
import com.monitor.model.request.ZkTreeAllReq;
import com.monitor.model.request.ZkTreeReq;
import com.monitor.model.response.BaseResponse;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
... ... @@ -166,6 +168,11 @@ public class ZkMonitorCtrl {
node.add(notExistsNode);
node.add(valueNotEqualNode);
zkMoitorService.compareRootTest(oldRoot,compareRoot,node);
//
FileUtils.writeLines(new File("/Data_new/monitor_logs/tttt"),node.get(0));
FileUtils.writeLines(new File("/Data_new/monitor_logs/tttt2"),node.get(1));
return new BaseResponse<Object>(node);
}
... ...
... ... @@ -346,7 +346,7 @@ public class ZkMoitorServiceImpl implements IZkMoitorService {
String newPath=compareRoot.concat("/").concat(nodeName);
Stat stat = client.checkExists().forPath(newPath);
if(stat==null){
notExistsNode.add(newPath);
notExistsNode.add(newPath+"-->"+data);
}else{
String newdata =new String(client.getData().forPath(newPath),"UTF-8");
if(newdata==null||data==null){
... ... @@ -354,7 +354,7 @@ public class ZkMoitorServiceImpl implements IZkMoitorService {
}else if(newdata!=null&&data!=null&&newdata.equals(data)){
}else{
valueNotEqualNode.add(newPath);
valueNotEqualNode.add(newPath+"-->"+data);
}
}
... ...