Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

thread  RSS feed

 
kumarth ravi
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are different states of a thread?how these states are interrelated?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15860
80
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google for "Java thread states" and within a few seconds you'll find lots of answers, like this one: Java Quick Reference - Thread States.
 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
One can also find different states of a thread in any Java book, with neat diagrams.
Actually the thread states together form the lifecycle of the thread, right from creation to destruction.

Hope this helps
 
kumarth ravi
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Have seen the material,I cound't understand the 2nd statement in dead state of the thread.,

Dead
1. a thread enters the dead state when it's run() method completes.
2 an interrupt does not kill a thread
3 the destroy() method kills a thread dead but does not release any of it's object locks.

Can you more explanation on that.
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


2 an interrupt does not kill a thread


An interrupt means a temporary pause/stop to the running thread does not mean the thread is killed. An active, currently running thread may be asked to wait for something. Thats what it means.

Is that clear?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interrupt refers to the interrupt() method you can call on a thread. The JavaDoc explains what might happen depending on what the thread is doing at the moment. "A short pause" is not one of them.
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Stan James! I was intended to say the description of wait() i suppose!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!