System.exit(0) in ShutDownHook causes hang on Windows7

Using Windows7, Java8, gradle 3.4.1 (and 3.3 before that), the following testcase causes gradle not to terminate (with or without daemon).

public class BugTest {

public static void init() throws IOException {
    Runtime.getRuntime().addShutdownHook(new Thread(() -> {

public void testFromDB_noVariant() {
    assertEquals(2, 3);

In case you wonder why anyone would do this: cassandra provides class CassandraDaemon that we wanted to use for JUnit tests, with one instance running for all test classes. But that class in stop() calls System.exit(0) for shutdown.