Skip to content

Commit 96b31e0

Browse files
committed
Separate method for readability
Issue: #3717 Signed-off-by: yongjunhong <[email protected]>
1 parent e12b155 commit 96b31e0

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

junit-vintage-engine/src/main/java/org/junit/vintage/engine/VintageTestEngine.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,22 @@ private void executeInParallel(VintageEngineDescriptor engineDescriptor,
134134
throw ExceptionUtils.throwAsUncheckedException(e.getCause());
135135
}
136136
finally {
137-
try {
138-
executorService.shutdown();
139-
if (!executorService.awaitTermination(SHUTDOWN_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
140-
logger.warn(() -> "Executor service did not terminate within the specified timeout");
141-
executorService.shutdownNow();
142-
}
143-
}
144-
catch (InterruptedException e) {
145-
logger.warn(e, () -> "Interruption while waiting for executor service to shut down");
146-
Thread.currentThread().interrupt();
137+
shutdownExecutorService(executorService);
138+
}
139+
}
140+
141+
private void shutdownExecutorService(ExecutorService executorService) {
142+
try {
143+
executorService.shutdown();
144+
if (!executorService.awaitTermination(SHUTDOWN_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
145+
logger.warn(() -> "Executor service did not terminate within the specified timeout");
146+
executorService.shutdownNow();
147147
}
148148
}
149+
catch (InterruptedException e) {
150+
logger.warn(e, () -> "Interruption while waiting for executor service to shut down");
151+
Thread.currentThread().interrupt();
152+
}
149153
}
150154

151155
private void executeSequentially(VintageEngineDescriptor engineDescriptor,

0 commit comments

Comments
 (0)