ThreadGroupEx.enumerate

Copies into the specified array every active thread in this thread group. If {@code recurse} is {@code true}, this method recursively enumerates all subgroups of this thread group and references to every active thread in these subgroups are also included. If the array is too short to hold all the threads, the extra threads are silently ignored.

<p> An application might use the {@linkplain #activeCount activeCount} method to get an estimate of how big the array should be, however <i>if the array is too short to hold all the threads, the extra threads are silently ignored.</i> If it is critical to obtain every active thread in this thread group, the caller should verify that the returned int value is strictly less than the length of {@code list}.

<p> Due to the inherent race condition in this method, it is recommended that the method only be used for debugging and monitoring purposes.

@param list an array into which to put the list of threads

@param recurse if {@code true}, recursively enumerate all subgroups of this thread group

@return the number of threads put into the array

@throws SecurityException if {@linkplain #checkAccess checkAccess} determines that the current thread cannot access this thread group

  1. int enumerate(Thread[] list)
  2. int enumerate(Thread[] list, bool recurse)
    class ThreadGroupEx
    int
    enumerate
    (
    Thread[] list
    ,
    bool recurse
    )
  3. int enumerate(ThreadGroupEx[] list)
  4. int enumerate(ThreadGroupEx[] list, bool recurse)

Meta