|
@@ -1,5 +1,6 @@
|
|
|
package com.css.simulation.resource.scheduler.manager;
|
|
|
|
|
|
+import api.common.pojo.common.ResponseBodyVO;
|
|
|
import api.common.pojo.constants.DictConstants;
|
|
|
import api.common.pojo.dto.ProjectMessageDTO;
|
|
|
import api.common.util.*;
|
|
@@ -34,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.FutureTask;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -132,9 +134,9 @@ public class TaskManager {
|
|
|
taskMapper.updateFailStateWithStopTime(taskId, state, TimeUtil.getNowForMysql(), DictConstants.TASK_ERROR_REASON_3);
|
|
|
} else if ("PendingAnalysis".equals(state)) {
|
|
|
taskMapper.updateSuccessStateWithStopTime(taskId, state, TimeUtil.getNowForMysql());
|
|
|
- // 创建视频和生成
|
|
|
-
|
|
|
- videoService.generateVideo(projectId, projectType, maxSimulationTime, taskId);
|
|
|
+ // 多线程创建视频和生成
|
|
|
+ FutureTask<ResponseBodyVO<String>> videoTask = new FutureTask<>(() -> videoService.generateVideo(projectId, projectType, maxSimulationTime, taskId));
|
|
|
+ new Thread(videoTask, "video-" + StringUtil.getRandomEightBitUUID()).start();
|
|
|
}
|
|
|
// -------------------------------- 判断项目是否结束 --------------------------------
|
|
|
ProjectMessageDTO projectMessageDTO = JsonUtil.jsonToBean(stringRedisTemplate.opsForValue().get(redisPrefix.getProjectRunningKey()), ProjectMessageDTO.class);
|