Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why thread is in running or runnable state why it is not terminated ?

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi well this is the server code i have coded this but i got this idea because of a book , but one thing is striking my mind and that is
when the click the button the print writer will flush the data to the client and a new thread is getting created ..but wait from here i cant understand whats happening
see the first time i click the button the data is send to the client and server starts a thread which is listening to the client so , as expected client will reply ..now server's listening thread is completed
after receiving the data from client ...... but
when i again send the message from the client why server's listening thread is still listening (i mean it is in running or runnable state and do back & forth between this two states)but the question is why the thread is not completed and go into terminated state why it is keep running ?



[edited for language]
 
Aditya Jha
Ranch Hand
Posts: 227
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, I understand you must have been frustrated with the problem, but try not to use language which may seem inappropriate in such a forum.

Secondly, whenever a thread refuses to die, there are 2 situations to check for - 1) A never-ending loop, and/or 2) An IO block.

What do you think could be happening here?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic