Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

daemon thread?

 
srikanth reddy
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The daemon status of a thread can be changed at any time using the Thread.setDaemon method??

why this is wrong ???is it that the status can be changed only at the begining of the thread???
 
Saurabh Chaubey
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The daemon status of a thread can be changed at any time using the Thread.setDaemon method??

why this is wrong ???is it that the status can be changed only at the begining of the thread???

The reason being that you cannot change the Daemon status of the thread after the start() method gets called otherwise a n IllegalThreadStateException is thrown. You should call the method Thread.setDaemon() before calling the start method on the thread.

I hope you got it.

Regards,
Saurabh
 
Roel De Nijs
Sheriff
Posts: 10763
147
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the K&B book i found nothing about deamon threads, so may i conclude this will not be on the exam?

also for the "you can call a method on a thread object after you invoke start, unless you get IllegalThreadStateException", nothing found in the book, and on school it was burned in like hell
 
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!