mojohaus / exec-maven-plugin

Exec Maven Plugin
https://www.mojohaus.org/exec-maven-plugin/
Apache License 2.0
163 stars 96 forks source link

[#391] Cope with Thread::stop being unavailable in JDK 20+ #393

Closed kriegaex closed 7 months ago

kriegaex commented 7 months ago

In JDK 20+, the long deprecated Thread.stop() (since JDK 1.2) has been removed and will throw an UnsupportedOperationException. This will be handled gracefully when using option stopUnresponsiveDaemonThreads, yielding a log warning "Thread.stop() is unavailable in this JRE version, cannot force-stop any threads" once and not trying to stop any further threads during the same execution.

Tests and documentation have been adjusted accordingly.

Closes #391.

kriegaex commented 7 months ago

@slawekjaranowski, this is ready for review.

slawekjaranowski commented 7 months ago

Thanks.

I think we also should deprecate options stopUnresponsiveDaemonThreads of exec:java

kriegaex commented 7 months ago

I think we also should deprecate options stopUnresponsiveDaemonThreads of exec:java

Despite Thread::stop being deprecated for a long time, it still works in JDK 17 LTS, which is just 2 years old, up to JDK 19 (1 year old). Given the fact that the plugin still is built with target 8, JDK 8 LTS being 9 years old, I guess that there might still be Java 17 users for many years to come. I just fixed the build for JDK 21 today. So, of course you can deprecate the option, but probably it will stick around for quite a while.