REQ-3104: 异常处理

This commit is contained in:
yanglin 2024-12-26 16:51:19 +08:00
parent 10c609f514
commit 840aa754cd

View File

@ -43,8 +43,7 @@ public class BatchController {
try { try {
task.run(); task.run();
} catch (Exception e) { } catch (Exception e) {
warn("operation failed", e); setOperationFailed(e);
error.compareAndSet(null, e);
} }
}; };
submitCount++; submitCount++;
@ -54,7 +53,16 @@ public class BatchController {
return; return;
} }
info(String.format("using async because of parallelismThreshold > %d", parallelismThreshold)); 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 { public void awaitTermination(long timeout, TimeUnit unit) throws Exception {