E
emily.ranyu
here is the api doc the threadgroup:
public int activeCount()
Returns an estimate of the number of active threads in this thread
group.
public int enumerate(Thread[] list)
Copies into the specified array every active thread in this thread
group and its subgroups. ... An application should use the activeCount
method to get an estimate of how big the array should be. ...
they all use the terminology "active thread"! BUT they operate in
different ways! in "activeCount()" it just returns the private variable
"nthreads" and "nthreads" increased when add method was invoked.
in "enumerate()" it will go through the thread list and check whether
it is alive.
that means, you will got some number after adding the thread into the
threadgroup without starting it, but it will tell you that there is NO
active thread in specified threadgroup when you go through the thread
list generated by "enumerate()"
is it ambiguous? is it a bug? or...
anybody can make it clear for me? thanks a lot!
public int activeCount()
Returns an estimate of the number of active threads in this thread
group.
public int enumerate(Thread[] list)
Copies into the specified array every active thread in this thread
group and its subgroups. ... An application should use the activeCount
method to get an estimate of how big the array should be. ...
they all use the terminology "active thread"! BUT they operate in
different ways! in "activeCount()" it just returns the private variable
"nthreads" and "nthreads" increased when add method was invoked.
in "enumerate()" it will go through the thread list and check whether
it is alive.
that means, you will got some number after adding the thread into the
threadgroup without starting it, but it will tell you that there is NO
active thread in specified threadgroup when you go through the thread
list generated by "enumerate()"
is it ambiguous? is it a bug? or...
anybody can make it clear for me? thanks a lot!