修改移除登录者信息报错

master
zengwh 5 years ago
parent 5f8291e2a8
commit ab4f3ad859

@ -5,7 +5,7 @@ import com.manage.vo.Power_UserVo;
import java.util.*; import java.util.*;
public class CacheManager { public class CacheManager {
private static HashMap cacheMap = new HashMap(); private static HashMap<String,Cache> cacheMap = new HashMap<String,Cache>();
//添加异常数量 //添加异常数量
public static void addExcCount(String type){ public static void addExcCount(String type){
if("noExc".equals(type)){ if("noExc".equals(type)){
@ -93,14 +93,15 @@ public class CacheManager {
//根据用户信息删除缓存 //根据用户信息删除缓存
private static void removeCacheByObject(Power_UserVo obj,String token) { private static void removeCacheByObject(Power_UserVo obj,String token) {
try { try {
Iterator i = cacheMap.entrySet().iterator(); if(cacheMap.size() > 0) {
while (i.hasNext()) { for (Map.Entry<String, Cache> map : cacheMap.entrySet()) {
Map.Entry<String,Object> entry = (Map.Entry) i.next(); Cache cache = CacheManager.getCacheInfo(map.getKey());
Cache cache = CacheManager.getCacheInfo(entry.getKey()); assert cache != null;
if(null != cache.getValue() && cache.getValue() instanceof Power_UserVo){ if (null != cache.getValue() && cache.getValue() instanceof Power_UserVo) {
Power_UserVo o = (Power_UserVo)cache.getValue(); Power_UserVo o = (Power_UserVo) cache.getValue();
if (obj.getUserName().equals(o.getUserName()) && !entry.getKey().equals(token)) { if (obj.getUserName().equals(o.getUserName()) && !map.getKey().equals(token)) {
clearOnly(entry.getKey()); clearOnly(map.getKey());
}
} }
} }
} }

Loading…
Cancel
Save