Skip to content

Commit

Permalink
Separate method for readability
Browse files Browse the repository at this point in the history
Issue: junit-team#3717
Signed-off-by: yongjunhong <kevin0928@naver.com>
  • Loading branch information
YongGoose committed Dec 21, 2024
1 parent f9ed440 commit f2ca078
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,22 @@ private void executeInParallel(VintageEngineDescriptor engineDescriptor,
throw ExceptionUtils.throwAsUncheckedException(e.getCause());
}
finally {
try {
executorService.shutdown();
if (!executorService.awaitTermination(SHUTDOWN_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
logger.warn(() -> "Executor service did not terminate within the specified timeout");
executorService.shutdownNow();
}
}
catch (InterruptedException e) {
logger.warn(e, () -> "Interruption while waiting for executor service to shut down");
Thread.currentThread().interrupt();
shutdownExecutorService(executorService);
}
}

private void shutdownExecutorService(ExecutorService executorService) {
try {
executorService.shutdown();
if (!executorService.awaitTermination(SHUTDOWN_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
logger.warn(() -> "Executor service did not terminate within the specified timeout");
executorService.shutdownNow();
}
}
catch (InterruptedException e) {
logger.warn(e, () -> "Interruption while waiting for executor service to shut down");
Thread.currentThread().interrupt();
}
}

private void executeSequentially(VintageEngineDescriptor engineDescriptor,
Expand Down

0 comments on commit f2ca078

Please sign in to comment.