Package io.netty.util
Class ThreadDeathWatcher
java.lang.Object
io.netty.util.ThreadDeathWatcher
Deprecated.
will be removed in the next major release
Checks if a thread is alive periodically and runs a task when a thread dies.
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Deprecated.private static final class
Deprecated. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final InternalLogger
Deprecated.private static final Queue
<ThreadDeathWatcher.Entry> Deprecated.private static final AtomicBoolean
Deprecated.(package private) static final ThreadFactory
Deprecated.private static final ThreadDeathWatcher.Watcher
Deprecated.private static Thread
Deprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
awaitInactivity
(long timeout, TimeUnit unit) Deprecated.Waits until the thread of this watcher has no threads to watch and terminates itself.private static void
Deprecated.static void
Deprecated.Cancels the task scheduled viawatch(Thread, Runnable)
.static void
Deprecated.Schedules the specifiedtask
to run when the specifiedthread
dies.
-
Field Details
-
logger
Deprecated. -
threadFactory
Deprecated. -
pendingEntries
Deprecated. -
watcher
Deprecated. -
started
Deprecated. -
watcherThread
Deprecated.
-
-
Constructor Details
-
ThreadDeathWatcher
private ThreadDeathWatcher()Deprecated.
-
-
Method Details
-
watch
Deprecated.Schedules the specifiedtask
to run when the specifiedthread
dies.- Parameters:
thread
- theThread
to watchtask
- theRunnable
to run when thethread
dies- Throws:
IllegalArgumentException
- if the specifiedthread
is not alive
-
unwatch
Deprecated.Cancels the task scheduled viawatch(Thread, Runnable)
. -
schedule
Deprecated. -
awaitInactivity
Deprecated.Waits until the thread of this watcher has no threads to watch and terminates itself. Because a new watcher thread will be started again onwatch(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 callingwatch(Thread, Runnable)
afterwards.- Returns:
true
if and only if the watcher thread has been terminated- Throws:
InterruptedException
-