This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Who clean up finished Timer's threads? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Who clean up finished Timer Watch "Who clean up finished Timer New topic

Who clean up finished Timer's threads?

tom chansky

Joined: Nov 01, 2004
Posts: 28
If a Timer class is scheduled to perform a certain task repeatedly, and when a scheduled task is finished, who will clean up or terminate or stop that thread? Is there anything that I can do to make sure those finished threads are cleaned up so that they will not occupy resources.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Did you try the JavaDoc for Timer? It talks about how Timers end, good or bad. You might make the Timer a daemon or cancel it at shutdown. I'm thinking I've never done that but never had any problems either. But I'm not so sure about the no problems.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: Who clean up finished Timer's threads?
It's not a secret anymore!