I understand the difference between a daemon thread and a regular thread. By calling setDaemon(true)
, the thread will be marked such that it will not keep the JVM alive. The JVM will automatically shut down when there are no more non-daemon threads running. When you start up the JVM, only the main thread is a non-daemon thread.
I also understand that the priority of a thread can be set independently of this. By calling setPriority(Thread.MAX_PRIORITY)
, the thread will be set to have the maximum scheduling priority allowed by its thread group. I feel like I have a good grasp on these concepts.
My question is - is there anything inherent in the daemon thread that would reduce its priority? or is it merely a flag saying "you don't have to wait for me to shut down the JVM"?
I'm working with a thread in a shared library that cannot be shutdown through the API. I have asked for this thread to be flagged as a daemon thread, but the owner is concerned that this will reduce its priority in the scheduler. It seems to me that since the priority is managed separately from the daemon thread designation, that they should be orthogonal. I'm having a hard time finding documentation of this, however.