public final class ThreadDeathWatcher extends java.lang.Object
This thread starts a daemon thread to check the state of the threads being watched and to invoke their
Runnables. When there is no thread to watch (i.e. all threads are dead), the daemon thread
will terminate itself, and a new daemon thread will be started again when a new watch is added.
|Modifier and Type||Method and Description|
Waits until the thread of this watcher has no threads to watch and terminates itself.
Cancels the task scheduled via
Schedules the specified
public static void watch(java.lang.Thread thread, java.lang.Runnable task)
taskto run when the specified
Runnableto run when the
java.lang.IllegalArgumentException- if the specified
threadis not alive
public static void unwatch(java.lang.Thread thread, java.lang.Runnable task)
public static boolean awaitInactivity(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
watch(Thread, Runnable), this operation is only useful when you want to ensure that the watcher thread is terminated after your application is shut down and there's no chance of calling
trueif and only if the watcher thread has been terminated
Copyright © 2008–2017 The Netty Project. All rights reserved.