Class DaemonThread

java.lang.Object
java.lang.Thread
org.sonews.daemon.DaemonThread
All Implemented Interfaces:
Runnable

public class DaemonThread extends Thread
Base class of all sonews threads. Instances of this class will be automatically registered at the ShutdownHook to be cleanly exited when the server is forced to exit.
Since:
sonews/0.5.0
Author:
Christian Lins
  • Constructor Details

    • DaemonThread

      public DaemonThread(Runnable run)
      Constructs a new DaemonThread with the given Runnable.
      Parameters:
      run -
  • Method Details

    • isRunning

      public boolean isRunning()
      Returns:
      true if shutdown() was not yet called.
    • setRunning

      protected void setRunning(boolean running)
      Set the running state of this daemon.
      Parameters:
      running -
    • requestShutdown

      public void requestShutdown()
      Marks this thread to exit soon. Closes the associated JDBCDatabase connection if available.
    • start

      public void start()
      Starts this daemon.
      Overrides:
      start in class Thread