动态人物管理增加自检机制。防止内存溢出

This commit is contained in:
648540858 2022-07-12 10:32:45 +08:00
parent 0f945910f3
commit 6d8569f340
5 changed files with 18 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -120,4 +121,19 @@ public class DynamicTask {
public Runnable get(String key) { public Runnable get(String key) {
return runnableMap.get(key); return runnableMap.get(key);
} }
/**
* 每五分钟检查失效的任务并移除
*/
@Scheduled(cron="0 0/5 * * * ?")
public void execute(){
if (futureMap.size() > 0) {
for (String key : futureMap.keySet()) {
if (futureMap.get(key).isDone()) {
futureMap.remove(key);
runnableMap.remove(key);
}
}
}
}
} }

View File

@ -1,4 +1,4 @@
package com.genersoft.iot.vmp.domain.req; package com.genersoft.iot.vmp.gb28181.bean;
/** /**

View File

@ -1,6 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
import com.genersoft.iot.vmp.domain.req.PresetQuerySipReq; import com.genersoft.iot.vmp.gb28181.bean.PresetQuerySipReq;
import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;

View File

@ -35,15 +35,9 @@ public class MediaController {
@Autowired @Autowired
private IRedisCatchStorage redisCatchStorage; private IRedisCatchStorage redisCatchStorage;
@Autowired
private IStreamPushService streamPushService;
@Autowired @Autowired
private IMediaService mediaService; private IMediaService mediaService;
@Autowired
private IMediaServerService mediaServerService;
/** /**
* 根据应用名和流id获取播放地址 * 根据应用名和流id获取播放地址

Binary file not shown.