|
...
|
...
|
@@ -10,6 +10,7 @@ import net.jodah.expiringmap.ExpiringMap; |
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -61,15 +62,17 @@ public class DeviceCach { |
|
|
|
}
|
|
|
|
public static void cleanDeviceHost(String deviceId)
|
|
|
|
{
|
|
|
|
if (parserDeviceHostDtoMap.containsKey(deviceId))
|
|
|
|
{
|
|
|
|
parserDeviceHostDtoMap.remove(deviceId);
|
|
|
|
}
|
|
|
|
for (String key :parserDeviceInfoDtoMap.keySet())
|
|
|
|
// 直接移除 host(无需先检查 containsKey)
|
|
|
|
parserDeviceHostDtoMap.remove(deviceId);
|
|
|
|
|
|
|
|
// 使用显式迭代器并调用 iterator.remove() 避免 ConcurrentModificationException
|
|
|
|
Iterator<String> it = parserDeviceInfoDtoMap.keySet().iterator();
|
|
|
|
while (it.hasNext())
|
|
|
|
{
|
|
|
|
if(key.startsWith(deviceId+"_"))
|
|
|
|
String key = it.next();
|
|
|
|
if (key.startsWith(deviceId + "_"))
|
|
|
|
{
|
|
|
|
parserDeviceInfoDtoMap.remove(key);
|
|
|
|
it.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
...
|
...
|
|