Class Shutdowner

java.lang.Object
java.lang.Thread
clazzfish.monitor.util.Shutdowner
All Implemented Interfaces:
Shutdownable, Runnable
Direct Known Subclasses:
AbstractMonitor, ClazzStatistic

public abstract class Shutdowner extends Thread implements Shutdownable
The class Shutdowner has the necessary methods for registration a class as shutdown hook. For this you must overwrite the Thread.run() method which is called during shutdown.
Since:
2.3 (29.11.24)
Author:
oboehm
  • Constructor Details

    • Shutdowner

      public Shutdowner()
  • Method Details

    • isShutdownHook

      public boolean isShutdownHook()
      Here you can ask if the class was already registered as shutdown hook.
      Specified by:
      isShutdownHook in interface Shutdownable
      Returns:
      true if it is registered as shutdown hook.
    • addMeAsShutdownHook

      public void addMeAsShutdownHook()
      To be able to register the class as shutdown hook via JMX we can't use a static method - this is the reason why this additional method was added.

      If this class is registered as shutdown hook from a web application a dump to a directory may not be possible because the application server (e.g. Tomcat) has been stopped already the web application instance. This was the problem as described in bugs/37.

      In this situation it is not possible to add the class as shutdown hook.

      Specified by:
      addMeAsShutdownHook in interface Shutdownable
    • removeMeAsShutdownHook

      public void removeMeAsShutdownHook()
      If you want to unregister the instance as shutdown hook you can use this (not static) method.
      Specified by:
      removeMeAsShutdownHook in interface Shutdownable