Commit dc5ae692 by 房斌

增加监控日志,和 增加调减判断

parent 161fa2bd
...@@ -40,7 +40,7 @@ public class DubboCustomerDownHock extends AbstractStop { ...@@ -40,7 +40,7 @@ public class DubboCustomerDownHock extends AbstractStop {
public ExecutorDetail stop() { public ExecutorDetail stop() {
ExecutorDetail detail = new ExecutorDetail(); ExecutorDetail detail = new ExecutorDetail();
detail.setBeginTime(DateUtil.getDateTime()); detail.setBeginTime(DateUtil.getDateTime());
detail.setServiceName("dubboDownHock1005"); detail.setServiceName("dubboDownHock1013");
List<String> str = new ArrayList<String>(); List<String> str = new ArrayList<String>();
detail.setDetail(str); detail.setDetail(str);
detail.setCode(0); detail.setCode(0);
...@@ -57,16 +57,17 @@ public class DubboCustomerDownHock extends AbstractStop { ...@@ -57,16 +57,17 @@ public class DubboCustomerDownHock extends AbstractStop {
while (iterator.hasNext()) { while (iterator.hasNext()) {
Registry r = iterator.next(); Registry r = iterator.next();
zookperRegster = (ZookeeperRegistry) r; zookperRegster = (ZookeeperRegistry) r;
logger.info("RegistryServerSync r-------------->"+zookperRegster.getRegistered().toString()); str.add(" DubboCustomerDownHock zookperRegstered-------------->"+zookperRegster.getRegistered().toString()+StringUtil.line());
if (zookperRegster.getRegistered() != null && zookperRegster.getRegistered().size() > 0) { if (zookperRegster.getRegistered() != null && zookperRegster.getRegistered().size() > 0) {
urls = zookperRegster.getRegistered(); urls = zookperRegster.getRegistered();
logger.info("RegistryServerSync urls-------------->"+((urls!=null&&urls.size()>0)?JSON.toJSONString(urls):"url si null")); str.add(" DubboCustomerDownHock zookperRegstered urls-------------->"+((urls!=null&&urls.size()>0)?JSON.toJSONString(urls):"url si null")+StringUtil.line());
if (urls != null && urls.size() > 0) { if (urls != null && urls.size() > 0) {
checks=new ArrayList<URL>(); checks=new ArrayList<URL>();
for (URL value : urls) { for (URL value : urls) {
checks.add(value); checks.add(value);
try { try {
str.add("provider url executer unregister before:" + value.getServiceInterface() + " time:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()) +StringUtil.line()); str.add("provider url executer unregister before:" + value.getServiceInterface() + " time:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()) +StringUtil.line());
// throw new IllegalStateException("failed to tet");
zookperRegster.unregister((URL) value); zookperRegster.unregister((URL) value);
LoggerUtil.info("provider url unregister success :" + value.getServiceInterface() + " time:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()) +StringUtil.line()); LoggerUtil.info("provider url unregister success :" + value.getServiceInterface() + " time:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()) +StringUtil.line());
str.add("delete provider url success:" + value.getServiceInterface() + " time:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()) +StringUtil.line()); str.add("delete provider url success:" + value.getServiceInterface() + " time:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()) +StringUtil.line());
...@@ -95,7 +96,9 @@ public class DubboCustomerDownHock extends AbstractStop { ...@@ -95,7 +96,9 @@ public class DubboCustomerDownHock extends AbstractStop {
for( URL url :checks) { for( URL url :checks) {
if (StringUtil.isNotEmpty(url.getAddress()) && StringUtil.isNotEmpty(name)) { if (StringUtil.isNotEmpty(url.getAddress()) && StringUtil.isNotEmpty(name)) {
List<String> check = null; List<String> check = null;
try { try {
// throw new IllegalStateException("failed to tet");
check = providerService.findServicesByAddressAndName(url.getAddress(), name); check = providerService.findServicesByAddressAndName(url.getAddress(), name);
} catch (Exception e) { } catch (Exception e) {
detail.setCode(-1); detail.setCode(-1);
...@@ -105,7 +108,9 @@ public class DubboCustomerDownHock extends AbstractStop { ...@@ -105,7 +108,9 @@ public class DubboCustomerDownHock extends AbstractStop {
str.add("warn:matrix-monitor check service failure " + url.getServiceKey() + " reason zk notice failed " + StringUtil.line()); str.add("warn:matrix-monitor check service failure " + url.getServiceKey() + " reason zk notice failed " + StringUtil.line());
detail.setCode(-1); detail.setCode(-1);
}else{ }else{
str.add("matrix-monitor dubbo check service ok " + url.getServiceKey() + StringUtil.line()); if(check!=null&&check.size()==0) {
str.add("matrix-monitor dubbo check service ok " + url.getServiceKey() + StringUtil.line());
}
} }
} }
......
...@@ -30,7 +30,7 @@ public class ServletConnectShoutDownHock extends AbstractStop { ...@@ -30,7 +30,7 @@ public class ServletConnectShoutDownHock extends AbstractStop {
public ExecutorDetail stop() { public ExecutorDetail stop() {
ExecutorDetail detail = new ExecutorDetail(); ExecutorDetail detail = new ExecutorDetail();
detail.setBeginTime(DateUtil.getDateTime()); detail.setBeginTime(DateUtil.getDateTime());
detail.setServiceName("ServletConnectShoutDownHock"); detail.setServiceName("ServletConnectShoutDownHock34");
List<String> str = new ArrayList<String>(); List<String> str = new ArrayList<String>();
detail.setDetail(str); detail.setDetail(str);
detail.setCode(0); detail.setCode(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment