public static void unwatch(Thread thread, Runnable task) {
        schedule(ObjectUtil.checkNotNull(thread, "thread"),
                ObjectUtil.checkNotNull(task, "task"),
                false);
    }
@Test
    @Timeout(value = 10000, unit = TimeUnit.MILLISECONDS)
    public void testUnwatch() throws Exception {
        final AtomicBoolean run = new AtomicBoolean();
        final Thread t = new Thread() {
            @Override
            public void run() {
                for (;;) {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException ignore) {
                        break;
                    }
                }
            }
        };

        final Runnable task = new Runnable() {
            @Override
            public void run() {
                run.set(true);
            }
        };

        t.start();

        // Watch and then unwatch.
        ThreadDeathWatcher.watch(t, task);
        ThreadDeathWatcher.unwatch(t, task);

        // Interrupt the thread to terminate it.
        t.interrupt();

        // Wait until the thread dies.
        t.join();

        // Wait until the watcher thread terminates itself.
        assertThat(ThreadDeathWatcher.awaitInactivity(Long.MAX_VALUE, TimeUnit.SECONDS), is(true));

        // And the task should not run.
        assertThat(run.get(), is(false));
    }