修改内存泄露
parent
298d104fec
commit
e66b839659
|
@ -23,7 +23,8 @@ public class SipSubscribe {
|
||||||
|
|
||||||
private Map<String, SipSubscribe.Event> okSubscribes = new ConcurrentHashMap<>();
|
private Map<String, SipSubscribe.Event> okSubscribes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private Map<String, Date> timeSubscribes = new ConcurrentHashMap<>();
|
private Map<String, Date> okTimeSubscribes = new ConcurrentHashMap<>();
|
||||||
|
private Map<String, Date> errorTimeSubscribes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
// @Scheduled(cron="*/5 * * * * ?") //每五秒执行一次
|
// @Scheduled(cron="*/5 * * * * ?") //每五秒执行一次
|
||||||
// @Scheduled(fixedRate= 100 * 60 * 60 )
|
// @Scheduled(fixedRate= 100 * 60 * 60 )
|
||||||
|
@ -33,14 +34,24 @@ public class SipSubscribe {
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTime(new Date());
|
calendar.setTime(new Date());
|
||||||
calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) - 1);
|
calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) - 1);
|
||||||
for (String key : timeSubscribes.keySet()) {
|
for (String key : okTimeSubscribes.keySet()) {
|
||||||
if (timeSubscribes.get(key).before(calendar.getTime())){
|
if (okTimeSubscribes.get(key).before(calendar.getTime())){
|
||||||
logger.info("[定时任务] 清理过期的订阅信息: {}", key);
|
logger.info("[定时任务] 清理过期的订阅信息: {}", key);
|
||||||
errorSubscribes.remove(key);
|
|
||||||
okSubscribes.remove(key);
|
okSubscribes.remove(key);
|
||||||
timeSubscribes.remove(key);
|
okTimeSubscribes.remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (String key : errorTimeSubscribes.keySet()) {
|
||||||
|
if (errorTimeSubscribes.get(key).before(calendar.getTime())){
|
||||||
|
logger.info("[定时任务] 清理过期的订阅信息: {}", key);
|
||||||
|
errorSubscribes.remove(key);
|
||||||
|
errorTimeSubscribes.remove(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.info("okTimeSubscribes.size:{}",okTimeSubscribes.size());
|
||||||
|
logger.info("okSubscribes.size:{}",okSubscribes.size());
|
||||||
|
logger.info("errorTimeSubscribes.size:{}",errorTimeSubscribes.size());
|
||||||
|
logger.info("errorSubscribes.size:{}",errorSubscribes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Event {
|
public interface Event {
|
||||||
|
|
Loading…
Reference in New Issue