Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
not necesarily
Posted by lucas on November 09, 2000 at 4:02 AM
Hi, I wanted to reply because i have some unanswered questions related to this subject ... >Any Java thread can be a daemon thread. Daemon threads are >service providers for other threads running in the same process >as the daemon thread. For example, u can develop an application >which uses daemon threads named "Image Fetcher" to fetch >images from the file system or network for any thread that >needs one. 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. When i think of a thread that is a daemon, purely as a concept independent from any OS, a daemon thread is a process that remains in the sistem running in the background(like daemons on Unix platforms) certainly in an infinite loop( i add,without looping very fast by sleeping a little bit every time to avoid CPU time consuming uselessly ). So, in my experience with java threads, the daemon_threads on java are released when the VM main thread exits, they cannot remain for ex in the win platform running on there own. As, on java VM environent what is the difference between a nondaemon thread that loops correctly and an identical thread that is a daemon? They live as long as they, or some other "stronger" thread, please. So, i think that "daemon" notion is related more to the OS-s. Maybe something slips in my knowledge and I see the things like this, in that case I appreciate any enlightment on the subject. Thank you, Lucas PS: I would be interested in a method to make java application to run like a service ,for example on an NT machine.(but i think that this has nothing to do with java :) )
Replies:
|