Authored by qinchao

修复memcache监控bug

... ... @@ -15,9 +15,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
... ... @@ -81,7 +79,7 @@ public class MemcachedMonitService {
//查询 memcached下的子类型(逻辑分组)
List<TypeInfo> childTypeList = redisMonitService.queryChildType(parentTypeInfo);
Set<String> currentKeys=new HashSet<>();
for (TypeInfo typeInfo : childTypeList) {
List<MObjectInfo> memcacheList = redisMonitService.queryMoByType(typeInfo);
... ... @@ -91,7 +89,11 @@ public class MemcachedMonitService {
{
String logicName = typeInfo.getTypeName();
List<MObjectInfo> sMemcacheList = serversMap.get(logicName);
currentKeys.add(logicName);
serversMap.put(logicName, memcacheList);
/*List<MObjectInfo> sMemcacheList = serversMap.get(logicName);
//该类型下没有查询过,则新插入
if (null == sMemcacheList) {
... ... @@ -104,11 +106,15 @@ public class MemcachedMonitService {
sMemcacheList.addAll(memcacheList);
}
}/*else{
/// 类型下没有监控对象 就把该类型去掉
MemConstants.MEMCACHED_RELATE_MAP.remove(logicName);
}*/
}*/
}
}
//把已经被去掉的不再监控对象的,从缓存中移除
for(String key:serversMap.keySet()){
if(!currentKeys.contains(key)){
serversMap.remove(key);
}
}
return serversMap;
... ...