From 840aa754cdc744887cfe130dd11d18979569fc1d Mon Sep 17 00:00:00 2001 From: yanglin Date: Thu, 26 Dec 2024 16:51:19 +0800 Subject: [PATCH] =?UTF-8?q?REQ-3104:=20=E5=BC=82=E5=B8=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/axzo/msg/center/utils/BatchController.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/inside-notices/src/main/java/cn/axzo/msg/center/utils/BatchController.java b/inside-notices/src/main/java/cn/axzo/msg/center/utils/BatchController.java index 74f2da00..ba346a96 100644 --- a/inside-notices/src/main/java/cn/axzo/msg/center/utils/BatchController.java +++ b/inside-notices/src/main/java/cn/axzo/msg/center/utils/BatchController.java @@ -43,8 +43,7 @@ public class BatchController { try { task.run(); } catch (Exception e) { - warn("operation failed", e); - error.compareAndSet(null, e); + setOperationFailed(e); } }; submitCount++; @@ -54,7 +53,16 @@ public class BatchController { return; } info(String.format("using async because of parallelismThreshold > %d", parallelismThreshold)); - asyncTasks.runAsync(runner); + try { + asyncTasks.runAsync(runner); + } catch (Exception e) { + setOperationFailed(e); + } + } + + private void setOperationFailed(Exception e) { + warn("operation failed", e); + error.compareAndSet(null, e); } public void awaitTermination(long timeout, TimeUnit unit) throws Exception {