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

finishing a thread

 
Paul Keohan
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a Thread completes whatever it's doing in its run() method, is that Thread object discarded and ready for garbage collection?
 
SAFROLE YUTANI
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regardless if a thread is running or not, if the number of references to that object is equal to or greater than 1, then it wont be a candidate for garbage collection.
After a thread returns from its run() method, it does not get destroyed by any means. It's still an object whose methods and attributes can be accessed by other objects.
SAF
 
Paul Keohan
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it only goes away when the JVM is no longer in use for whatever application you're running?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!