Class MyThread

  • All Implemented Interfaces:
    Runnable

    public class MyThread
    extends Thread
    MyThread knows child threads and can also be a child-thread as well, which should know its parent thread.
    This is used to automatically interrupt all child threads if the parent thread is interrupted.
    • Constructor Detail

      • MyThread

        public MyThread​(Runnable run,
                        Thread parentThread,
                        boolean addChildToParent)
    • Method Detail

      • getParentThread

        public Thread getParentThread()
      • interrupt

        public void interrupt()
        Overrides:
        interrupt in class Thread
      • setInterrupted

        public void setInterrupted​(boolean interrupted)