Class ThreadRegistry


  • public class ThreadRegistry
    extends java.lang.Object
    This class maintains a simple running/terminating status, tracks threads and timers created by the application, and ensures they are properly cleaned up when we terminate.
    • Constructor Detail

      • ThreadRegistry

        public ThreadRegistry()
    • Method Detail

      • register

        public void register​(java.lang.Thread thread)
        Registers thread. Please ensure thread can be terminated with an interrupt, i.e. interrupts should not be caught and ignored. When interrupted, the thread should proceed to clean itself up and terminate.
      • register

        public void register​(java.util.Timer timer)
      • isTerminating

        public boolean isTerminating()
        Returns whether application is terminating. Will only return true if terminate() was invoked.
      • terminate

        public void terminate()
        Interrupts all registered threads, and cancels timers. This is normally triggered from an application controller when its shutdown.