REQ-3828: fix error handling
This commit is contained in:
parent
da96e90056
commit
93323fb4e0
@ -34,14 +34,7 @@ public class BatchController {
|
||||
}
|
||||
|
||||
public void submit(Runnable task) {
|
||||
submitCount++;
|
||||
if (submitCount <= parallelismThreshold) {
|
||||
info("using sync");
|
||||
task.run();
|
||||
return;
|
||||
}
|
||||
info(String.format("using async because of parallelismThreshold > %d", parallelismThreshold));
|
||||
asyncTasks.runAsync(() -> {
|
||||
Runnable runner = () -> {
|
||||
Exception exception = error.get();
|
||||
if (exception != null) {
|
||||
warn("operation aborted because of other batch's error", exception);
|
||||
@ -53,7 +46,15 @@ public class BatchController {
|
||||
warn("operation failed", e);
|
||||
error.compareAndSet(null, e);
|
||||
}
|
||||
});
|
||||
};
|
||||
submitCount++;
|
||||
if (submitCount <= parallelismThreshold) {
|
||||
info("using sync");
|
||||
runner.run();
|
||||
return;
|
||||
}
|
||||
info(String.format("using async because of parallelismThreshold > %d", parallelismThreshold));
|
||||
asyncTasks.runAsync(runner);
|
||||
}
|
||||
|
||||
public void awaitTermination(long timeout, TimeUnit unit) throws Exception {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user