A
avinashrk
Hi
We hava base class server which creates worker threads and everytime it
creates these threads it pushes them into a ThreadGroup thereby
automatically incrementing the activeCount on this ThreadGroup.As I
understand it when the child thread exits its run method, it should die
and hence the ThreadGroup count should automatically go down.However
this was not happening in my code. Initially i thought I might have
written something wrong and so the run method hangs and some threads
dont die. So I put some print statements to see if the worker thread
was coming out of the run method and to my surprise it was and still
the activeCount wont go down...
Since there was some important decision logic based on this active
count I just got rid of the ThreadGroup and kept a count of
activethreads myself by using a varaiblw which was incremented for
every thread created and decremented for every thread exiting out of
its run method...So now the program works fine...mind you there was no
other change i did..so the only thing I can point this to is some kind
of problem with activeCount method in threadGroups....Has anyone else
seen this kind of behavior? Any advice or tips would help
Thanks
Avinash
We hava base class server which creates worker threads and everytime it
creates these threads it pushes them into a ThreadGroup thereby
automatically incrementing the activeCount on this ThreadGroup.As I
understand it when the child thread exits its run method, it should die
and hence the ThreadGroup count should automatically go down.However
this was not happening in my code. Initially i thought I might have
written something wrong and so the run method hangs and some threads
dont die. So I put some print statements to see if the worker thread
was coming out of the run method and to my surprise it was and still
the activeCount wont go down...
Since there was some important decision logic based on this active
count I just got rid of the ThreadGroup and kept a count of
activethreads myself by using a varaiblw which was incremented for
every thread created and decremented for every thread exiting out of
its run method...So now the program works fine...mind you there was no
other change i did..so the only thing I can point this to is some kind
of problem with activeCount method in threadGroups....Has anyone else
seen this kind of behavior? Any advice or tips would help
Thanks
Avinash