@Deprecated public final class ThreadDeathWatcher extends Object
This thread starts a daemon thread to check the state of the threads being watched and to invoke their
associated Runnable
s. 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 |
---|---|
static boolean |
awaitInactivity(long timeout,
TimeUnit unit)
Deprecated.
Waits until the thread of this watcher has no threads to watch and terminates itself.
|
static void |
unwatch(Thread thread,
Runnable task)
Deprecated.
Cancels the task scheduled via
watch(Thread, Runnable) . |
static void |
watch(Thread thread,
Runnable task)
Deprecated.
Schedules the specified
task to run when the specified thread dies. |
public static void watch(Thread thread, Runnable task)
task
to run when the specified thread
dies.thread
- the Thread
to watchtask
- the Runnable
to run when the thread
diesIllegalArgumentException
- if the specified thread
is not alivepublic static void unwatch(Thread thread, Runnable task)
watch(Thread, Runnable)
.public static boolean awaitInactivity(long timeout, TimeUnit unit) throws 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
watch(Thread, Runnable)
afterwards.true
if and only if the watcher thread has been terminatedInterruptedException
Copyright © 2008–2024 The Netty Project. All rights reserved.