Dariusz Kuc
05/14/2020, 8:02 PMfun main() {
val client = HttpClient(...)
runBlocking {
// invoke some endpoint
}
client.close()
}
The above works perfectly fine when executed using Gradle application plugin, e.g.
application {
mainClassName = "com.example.ApplicationKt"
}
but it blows up when run using Maven exec
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass>com.example.ApplicationKt</mainClass>
</configuration>
</plugin>
with following
[WARNING] thread Thread[kotlinx.coroutines.DefaultExecutor,5,com.example.ApplicationKt] was interrupted but is still alive after waiting at least 14998msecs
[WARNING] thread Thread[kotlinx.coroutines.DefaultExecutor,5,com.example.ApplicationKt] will linger despite being asked to die via interruption
[WARNING] NOTE: 1 thread(s) did not finish despite being asked to via interruption. This is not a problem with exec:java, it is a problem with the running code. Although not serious, it should be remedied.
[WARNING] Couldn't destroy threadgroup org.codehaus.mojo.exec.ExecJavaMojo$IsolatedThreadGroup[name=com.example.ApplicationKt,maxpri=10]
java.lang.IllegalThreadStateException
at java.lang.ThreadGroup.destroy (ThreadGroup.java:776)
any ideas?