Daemon (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.util, class: Daemon

Package org.apache.hadoop.util

# Class Daemon

java.lang.Object
java.lang.Thread
org.apache.hadoop.util.Daemon

All Implemented Interfaces:
  `Runnable`

Direct Known Subclasses:
  `Daemon.DaemonFactory`

@LimitedPrivate({"HDFS","MapReduce"}) @Unstable public class Daemon extends Thread
A thread that has called `Thread.setDaemon(boolean)` with true.

The runnable code must either be specified in the runnable parameter or in the overridden work() method.

See `SubjectInheritingThread` for the Subject inheritance behavior this class adds.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `Daemon.DaemonFactory`
  Provide a factory for named daemon threads, for use in ExecutorServices constructors

  ## Nested classes/interfaces inherited from class java.lang.Thread

  `Thread.State, Thread.UncaughtExceptionHandler`

- ## Field Summary

  ### Fields inherited from class java.lang.Thread

  `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Daemon()`
  Construct a daemon thread.
  `Daemon(Runnable runnable)`
  Construct a daemon thread.
  `Daemon(ThreadGroup group, Runnable runnable)`
  Construct a daemon thread to be part of a specified thread group.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Runnable`
  `getRunnable()`
  `final void`
  `run()`
  `final void`
  `start()`
  `void`
  `work()`
  Override this instead of run()

  ### Methods inherited from class java.lang.Thread

  `activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, suspend, toString, yield`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### Daemon

    public Daemon()
    Construct a daemon thread.

  - ### Daemon

    public Daemon(Runnable runnable)
    Construct a daemon thread.
    Parameters:
      `runnable` - runnable.

  - ### Daemon

    public Daemon(ThreadGroup group, Runnable runnable)
    Construct a daemon thread to be part of a specified thread group.
    Parameters:
      `group` - thread group.
      `runnable` - runnable.

- ## Method Details

  - ### start

    public final void start()
    Overrides:
      `start` in class `Thread`

  - ### work

    public void work()
    Override this instead of run()

  - ### run

    public final void run()
    Specified by:
      `run` in interface `Runnable`
    Overrides:
      `run` in class `Thread`

  - ### getRunnable

    public Runnable getRunnable()