Skip to content

Commit 11924e5

Browse files
committed
interrupt if error on thread post-execution
1 parent 8a1cb72 commit 11924e5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/main/java/tech/fastj/systems/execution/FastJScheduledThreadPool.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,17 @@ protected void afterExecute(Runnable runnable, Throwable throwable) {
9797
}
9898

9999
if (throwable != null) {
100-
FastJEngine.error("Error received while executing task", throwable);
100+
try {
101+
FastJEngine.error("Error received while executing task", throwable);
101102

102-
if (shouldCloseOnError) {
103-
FastJEngine.forceCloseGame();
104-
}
103+
if (shouldCloseOnError) {
104+
FastJEngine.forceCloseGame();
105+
}
105106

106-
throw new IllegalStateException(throwable);
107+
throw new IllegalStateException(throwable);
108+
} finally {
109+
Thread.currentThread().interrupt();
110+
}
107111
}
108112
}
109113
}

0 commit comments

Comments
 (0)