This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes Keep-Alive-Timer Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Keep-Alive-Timer Thread" Watch "Keep-Alive-Timer Thread" New topic

Keep-Alive-Timer Thread

Steven Zaluk

Joined: Sep 19, 2003
Posts: 3
I created a multi-threaded application where each thread posts an XML request to an HTTP server. I place each thread in a ThreadGroup. I noticed that when I poll the number of active threads in the ThreadGroup by using the actievCount() method, I always have one thread active. When I debug the thread and print the contents of the ThreadGroup at 500 ms intervals using the list() method I see my threads but after all my threads are finished and die, I see the following:
This thread never dies. Does anyone know what this thread is and how it got placed in the ThreadGroup? This thread is not present when I have my threads still active. I am using JDK 1.3.1. Any help would be appreciated.
Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

Every thread group requires a monitor thread that maintains state information about the other threads in the group. So it's just running around in the group and checking on your worker threads.
It's generally not that efficient to create a group per working thread for that reason.

Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Steven Zaluk

Joined: Sep 19, 2003
Posts: 3
When I have worker threads in the group this Keep-Alive-Timer thread is not there. It is only present when all my threads have finished executing.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Keep-Alive-Timer Thread
It's not a secret anymore!