This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes setDaemon Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "setDaemon" Watch "setDaemon" New topic
Author

setDaemon

saravanan ragunathan
Ranch Hand

Joined: Aug 02, 2010
Posts: 84


when i run this code it generates IllegalThreadStateException in runtime
how can i rectify this

"I Love Java Ranch"
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Have you read the documentation? Because the answer is right there.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Santosh Kumar Nayak
Ranch Hand

Joined: Aug 02, 2011
Posts: 92
setDaemon() has to be specified before the execution of the thread.start() method.

While the thread is executing specifying the thread as daemon is not allowed.
 
Consider Paul's rocket mass heater.
 
subject: setDaemon
 
Similar Threads
How setDaemon works
setDaemon
Doubt on setDeamon().
setDaemon method
what could be the answer ...