@Deprecated
public final class ThreadDeathWatcher
extends java.lang.Object
该线程启动一个守护进程线程来检查正在监视的线程的状态并调用其关联的Runnable 。 当没有线程可以观察时(即所有线程都已经死掉),守护进程线程将自行终止,并且在添加新的手表时,新的守护进程线程将再次启动。
| Modifier and Type | Method and Description |
|---|---|
static boolean |
awaitInactivity(long timeout, java.util.concurrent.TimeUnit unit)
已过时。
等到这个观察者的线程没有线程观看并终止它自己。
|
static void |
unwatch(java.lang.Thread thread, java.lang.Runnable task)
已过时。
通过
watch(Thread, Runnable)取消预定的任务。
|
static void |
watch(java.lang.Thread thread, java.lang.Runnable task)
已过时。
计划指定的
task在指定的
thread死亡时运行。
|
public static void watch(java.lang.Thread thread,
java.lang.Runnable task)
thread死亡时,计划指定的
task运行。
thread -
Thread观看
task -在
Runnable运行时
thread模具
java.lang.IllegalArgumentException - 如果指定的
thread不存在
public static void unwatch(java.lang.Thread thread,
java.lang.Runnable task)
watch(Thread, Runnable)计划的任务。
public static boolean awaitInactivity(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
watch(Thread, Runnable)上重新启动,因此此操作仅用于在应用程序关闭后确保观察程序线程终止并且之后不会再调用watch(Thread, Runnable)的情况 。
true当且仅当观察者线程已被终止
java.lang.InterruptedException
Copyright © 2008–2018 The Netty Project. All rights reserved.