From b0c8643e920b1084e79728621f71f74703f675af Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Tue, 17 Jun 2025 14:12:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=80=E4=B8=8B=E5=88=87?= =?UTF-8?q?=E7=89=87=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ycwl/basic/task/VideoPieceGetter.java | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/ycwl/basic/task/VideoPieceGetter.java b/src/main/java/com/ycwl/basic/task/VideoPieceGetter.java index 0d1d9c9..af8cdb2 100644 --- a/src/main/java/com/ycwl/basic/task/VideoPieceGetter.java +++ b/src/main/java/com/ycwl/basic/task/VideoPieceGetter.java @@ -181,26 +181,22 @@ public class VideoPieceGetter { .map(Map.Entry::getKey).forEach(pairDeviceId -> { log.info("找到同景区关联设备:{} -> {}", pairDeviceId, faceSample.getDeviceId()); if (pairDeviceId != null) { - executor.execute(() -> { - doCut(pairDeviceId, faceSample.getId(), faceSample.getCreateAt(), task); - currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString()); - }); + doCut(pairDeviceId, faceSample.getId(), faceSample.getCreateAt(), task); + currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString()); } }); } - executor.execute(() -> { - doCut(faceSample.getDeviceId(), faceSample.getId(), faceSample.getCreateAt(), task); - currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString()); - if (templatePlaceholder != null) { - log.info("当前进度:!{}/{}", currentUnFinPlaceholder.size(), templatePlaceholder.size()); - if (currentUnFinPlaceholder.isEmpty()) { - if (!invoke.get()) { - invoke.set(true); - task.getCallback().onInvoke(); - } + doCut(faceSample.getDeviceId(), faceSample.getId(), faceSample.getCreateAt(), task); + currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString()); + if (templatePlaceholder != null) { + log.info("当前进度:!{}/{}", currentUnFinPlaceholder.size(), templatePlaceholder.size()); + if (currentUnFinPlaceholder.isEmpty()) { + if (!invoke.get()) { + invoke.set(true); + task.getCallback().onInvoke(); } } - }); + } }); }); }); @@ -210,6 +206,7 @@ public class VideoPieceGetter { executor.shutdown(); executor.awaitTermination(5, TimeUnit.MINUTES); log.info("executor已结束![A:{}/T:{}/F:{}]", executor.getActiveCount(), executor.getTaskCount(), executor.getCompletedTaskCount()); + executor.close(); } catch (InterruptedException e) { return; } finally {