因为项目部署在阿里云服务器上,登陆阿里云服务器,发现服务器CPU一直是100%使用;
解决问题
HashSet<HttpSession> sessionSet=(HashSet<HttpSession>) context.getAttribute("sessionSet"); Set<HttpSession> httpSessions = Collections.synchronizedSet(sessionSet); if(httpSessions==null){ httpSessions=new HashSet<HttpSession>(); context.setAttribute("sessionSet", httpSessions); }
原文:https://www.cnblogs.com/wobuchifanqie/p/12190923.html