fix: 接口执行空指针异常

This commit is contained in:
shiziyuan9527 2021-08-17 14:52:23 +08:00 committed by 刘瑞斌
parent ed00bfe960
commit ff1ac93fa3
2 changed files with 7 additions and 3 deletions

View File

@ -82,8 +82,8 @@ public class APIBackendListenerHandler {
testResult.setConsole(resultService.getJmeterLogger(testId, true));
testResultService.saveResult(testResult, this.runMode, this.debugReportId, this.testId);
// 清除已经中断的过程数据
if (!MessageCache.reportCache.containsKey(testId) && resultService.processCache.containsKey(testId)) {
resultService.processCache.remove(testId);
if (!MessageCache.reportCache.containsKey(testId) && resultService.getProcessCache().containsKey(testId)) {
resultService.getProcessCache().remove(testId);
}
}

View File

@ -24,7 +24,11 @@ import java.util.stream.Collectors;
public class MsResultService {
// 零时存放实时结果
private Cache cache = Cache.newHardMemoryCache(0, 3600 * 2);
public ConcurrentHashMap<String, List<SampleResult>> processCache = new ConcurrentHashMap<>();
private ConcurrentHashMap<String, List<SampleResult>> processCache = new ConcurrentHashMap<>();
public ConcurrentHashMap<String, List<SampleResult>> getProcessCache() {
return processCache;
}
private final static String THREAD_SPLIT = " ";