Package org.apache.commons.exec

# Class Watchdog

java.lang.Object
org.apache.commons.exec.Watchdog

All Implemented Interfaces:
  `Runnable`

public class Watchdog extends Object implements Runnable
Generalization of `ExecuteWatchdog`.

See Also:
  - `ExecuteWatchdog`

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `Watchdog.Builder`
  Builds ExecuteWatchdog instances.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Watchdog(long timeoutMillis)`
  Deprecated.
  Use `Watchdog.Builder.get()`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addTimeoutObserver(TimeoutObserver to)`
  Adds a TimeoutObserver.
  `static Watchdog.Builder`
  `builder()`
  Creates a new builder.
  `protected final void`
  `fireTimeoutOccured()`
  Fires a timeout occurred event for each observer.
  `void`
  `removeTimeoutObserver(TimeoutObserver to)`
  Removes a TimeoutObserver.
  `void`
  `run()`
  `void`
  `start()`
  Starts a new thread.
  `void`
  `stop()`
  Requests a thread stop.

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

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

- ## Constructor Details

  - ### Watchdog

    @Deprecated public Watchdog(long timeoutMillis)
    Deprecated.
    Use `Watchdog.Builder.get()`.
    Constructs a new instance.
    Parameters:
      `timeoutMillis` - the timeout duration.

- ## Method Details

  - ### builder

    public static Watchdog.Builder builder()
    Creates a new builder.
    Returns:
      a new builder.
    Since:
      1.4.0

  - ### addTimeoutObserver

    public void addTimeoutObserver(TimeoutObserver to)
    Adds a TimeoutObserver.
    Parameters:
      `to` - a TimeoutObserver to add.

  - ### fireTimeoutOccured

    protected final void fireTimeoutOccured()
    Fires a timeout occurred event for each observer.

  - ### removeTimeoutObserver

    public void removeTimeoutObserver(TimeoutObserver to)
    Removes a TimeoutObserver.
    Parameters:
      `to` - a TimeoutObserver to remove.

  - ### run

    public void run()
    Specified by:
      `run` in interface `Runnable`

  - ### start

    public void start()
    Starts a new thread.

  - ### stop

    public void stop()
    Requests a thread stop.