| Author |
Daemon Thread. Aplication - Applet
|
Vishnu Prakash
Ranch Hand
Joined: Nov 15, 2004
Posts: 1026
|
|
Is there any difference between using setDaemon(true) method in an application and a applet. I created a Thread in the constructor and made setDaemon(true) and called start() method and inside run method I call other methods in the application. Unfortunately the application runs to completion before making a call to other methods of the class. This happens because Daemon thread are there to serve the user threads, So Once there is no user thread the application ends. My question is then why does the same is not happening in Applet. I created a thread and made setDaemon(true) in the init() method and called the start() method and inside run method I call other methods in the applet. This is working fine. How this is happening ?
|
Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
|
Because the JVM doesn't exit -- it's running inside the browser, and stays running. Your applet gets destroyed, including all the Threads, but just because your threads end, this doesn't mean the JVM will exit.
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
|
|
subject: Daemon Thread. Aplication - Applet
|
|
|