> Kees Jongenburger <[EMAIL PROTECTED]> wrote: > > Code in the email application does not start threads a daemon , this > prevents mmbase from restarting correctely after a "touch web.xml" > > I was wondering if this rule is not a bit the absolute. I think that > threads > which are garanteed to stop in a a relativily short time by them self > could > logically just as well not be a daemon, and can simply finish their job > first if someone touches web.xml. > > Is there any other difference between daemon and non-daemon threads > besides > this specific property of them (perhaps in terms of efficiency)?
Daemon threads are service providers for other threads running in the same process as the daemon thread. The run() method for a daemon thread is typically an infinite loop that waits for a service request. When the only remaining threads in a process are daemon threads, the interpreter exits. This makes sense because when only daemon threads remain, there is no other thread for which a daemon thread can provide a service. In general, threads that run application code are not daemon thread, and threads that run system code are daemon threads. Eg. the garbage collector is a daemon thread. Nico Klasens Finalist IT Group Java Specialists
