History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QUARTZ-674
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: James House
Reporter: Rex Wang
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Quartz Scheduler

shutdown() method of class SimpleThreadPool alert redundent information about alive threads with shutdown hook enabled

Created: 16/Jun/08 07:09 AM   Updated: 20/Jun/08 08:38 AM
Component/s: Thread Pools
Affects Version/s: 1.6
Fix Version/s: None

Environment: Window XP SP 2, JAVA 1.5

Flags: Important


 Description  « Hide
I have enabled the shutdown hook to clean some application specific resource during gracefully shutting down Quartz. But I always got the following alerts.

"There are still 9 worker threads active. See javadoc runInThread(Runnable) for a possible explanation" (Of course the number may not be the same every time). But all the executing Jobs will be finished without issues.

Then I just wonder what I have missed, and I review the code. There is such a code snatch in shutdown() method of class SimpleThreadPool.

"
 int activeCount = threadGroup.activeCount();
                if (activeCount > 0) {
                    getLog().info(
                        "There are still " + activeCount + " worker threads active."
                        + " See javadoc runInThread(Runnable) for a possible explanation");
                }
"

The curiosity make me add folllowing simple code to see those threads clearly:
"
                 Thread[] results = new Thread[100];
                    getLog().info("Get alive threads results: " + threadGroup.enumerate(results));
                    for (int i = 0; i < results.length; i++) {
Thread thread = results[i];
getLog().info("Thread detail: " + thread.getName() +" " + thread.getState());
}
"

There are still some threads have not been cleaned, for instance:
QuartzScheduler_LTS-NON_CLUSTERED_MisfireHandler
DestroyJavaVM
HouseKeeper
Prototyper

This is just because we use the root Thread group, so my recomendation is:
1. If we only want to alert the alive worker threads, we need to do something more to track those workers threads directly instead of just get a number from the root thread group.
2. If we would like to notify the user that there may be some threads still alive need to be concerned, we can change the alert key words "worker thread" (Cause this may lead to some misunderstanding) . More than that we can provide more detailed information of those alive threads.

Thanks.







 All   Comments   Change History      Sort Order:
James House - [20/Jun/08 08:38 AM ]

I simply removed that logging. The block above logs what's going on with the worker threads, and this additional logging is purely superfluous, not sure why it was ever "interesting".