simplified threading

razvanc
2008-03-20
2013-05-02
  • razvanc
    razvanc
    2008-03-20

    I'm using this as a library in my application, thus it can't just do whatever it wants with the threads, especially since it doesn't die peacefully when needed (it holds up the other stuff for some reason)...

    didn't investigate in detail, I just changed a few files to:
    1. name the threads properly, so it's simpler to debug
    2. mark all unneccesary threads as daemons, so the JVM dies when my application threads end...

    the changes are all like this:

        public void start()
        {
            deviceSearchThread = new Thread(this);
           
            /* RazvanC 2008-03: name the thread for debugging and daemonize it since they don't die easily*/
          deviceSearchThread.setName("CyberSSDPSearch"+deviceSearchThread.getName());   
          deviceSearchThread.setDaemon(true);
             
            deviceSearchThread.start();
        }

    ...can extract patch and send or checkin if you allow me and point me to junits to run :)