Reputation: 4427
What happens to a thread once it hits the ends? Does it kill itself? or does it float around in memory taking up space? what exactly happens?
new Thread(new Runnable() {
public void run() {
//do some stuff
...
//ok... did some stuff, now what?
}
}).start();
Upvotes: 1
Views: 76
Reputation: 7773
It just simply ends like a normal piece of program. and Garbage Collector can recycle the memory it took. If you want the thread continues to run, you would use it with a while loop or so.
Upvotes: 0
Reputation: 20067
It finishes and all it's ThreadLocal objects become eligible for Garbage collection.
Upvotes: 3