Skip to content

Commit

Permalink
#2883 move service initialization up
Browse files Browse the repository at this point in the history
  • Loading branch information
c71n93 committed Feb 21, 2024
1 parent 7dddfc7 commit 8eac6eb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,8 @@ protected final ForeignTojos scopedTojos() {
* @throws TimeoutException If timeout limit reached
*/
private void execWithTimeout() throws ExecutionException, TimeoutException {
ExecutorService service = null;
final ExecutorService service = Executors.newSingleThreadExecutor();
try {
service = Executors.newSingleThreadExecutor();
service.submit(
() -> {
this.exec();
Expand All @@ -347,9 +346,7 @@ private void execWithTimeout() throws ExecutionException, TimeoutException {
ex
);
} finally {
if (service != null) {
service.shutdown();
}
service.shutdown();
}
}

Expand Down

0 comments on commit 8eac6eb

Please sign in to comment.