Authored by linlong

memcached获取失败从缓存中移除

... ... @@ -82,7 +82,7 @@ public class MemcachedMonitorImpl {
* @param monitorUrl 监控url
*/
private void doMonitor(StringBuffer monitorUrl) {
Map<InetSocketAddress, Map<String, String>> result = new HashMap<>();
Map<InetSocketAddress, Map<String, String>> result = new HashMap<>();
try {
MemcachedClient client = new XMemcachedClient(AddrUtil.getAddresses(monitorUrl.toString().trim()));
result = client.getStats();
... ... @@ -177,6 +177,8 @@ public class MemcachedMonitorImpl {
StringBuffer failUrl = new StringBuffer();
for (InetSocketAddress address: monitorUrlSet) {
failUrl.append(address.toString()+" ");
//获取失败时从缓存中移除数据
MemConstants.MEMCACHED_INFO_MAP.remove(address.toString().substring(1,address.toString().length()));
}
alarmMsgService.sendSms("Memcached", "Failed to get Memcached status" + failUrl.toString() + " .", snsMobileConfig.getBaseMobile());
... ...