refactor(通用功能): 修改停止导出任务

This commit is contained in:
guoyuqi 2024-08-12 10:38:54 +08:00 committed by Craftsman
parent 422456a8e2
commit be98b48492
1 changed files with 3 additions and 2 deletions

View File

@ -38,12 +38,13 @@ public class ExportTaskManager {
ExportTask exportTask = buildExportTask(projectId, fileId, userId, type); ExportTask exportTask = buildExportTask(projectId, fileId, userId, type);
ExecutorService executorService = Executors.newFixedThreadPool(1); ExecutorService executorService = Executors.newFixedThreadPool(1);
Future<?> future = executorService.submit(() -> { Future<?> future = executorService.submit(() -> {
while (!Thread.currentThread().isInterrupted()) { if (!Thread.currentThread().isInterrupted()) {
// 线程任务逻辑 // 线程任务逻辑
LogUtils.info("Thread has been start."); LogUtils.info("Thread has been start.");
selectListFunc.apply(t); selectListFunc.apply(t);
} else {
LogUtils.info("Thread has been interrupted.");
} }
LogUtils.info("Thread has been interrupted.");
}); });
map.put(exportTask.getId(), future); map.put(exportTask.getId(), future);
return exportTask; return exportTask;