Class TerminationMonitor

  • All Implemented Interfaces:
    Runnable

    public class TerminationMonitor
    extends Thread
    Simple shutdown monitor, which allows for watching
    • Field Detail

      • MSG_TERMINATION

        protected static final String MSG_TERMINATION
        Message template for forcing termination.
        See Also:
        Constant Field Values
      • dumpIntervalSeconds

        protected final long dumpIntervalSeconds
        In an interval of the given amount of seconds, the thread will perform an informational thread dump which allows to analyse the situation.
      • exitSeconds

        protected final int exitSeconds
        If a value > 0 is provided, the thread will use System.exit(1) to terminate the Java process.
      • output

        protected final PrintStream output
        Stream where to print thread dumps to.
    • Constructor Detail

      • TerminationMonitor

        public TerminationMonitor​(PrintStream output,
                                  int threadDumpIntervalSeconds,
                                  int systemExitSeconds)
        Parameters:
        output - Stream where to print thread dumps to.
        threadDumpIntervalSeconds - In an interval of the given amount of seconds, the thread will perform an informational thread dump which allows to analyse the situation.
        systemExitSeconds - If a value > 0 is provided, the thread will use System.exit(1) to terminate the Java process.
    • Method Detail

      • run

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