private void remove ( ThreadGroup g ) { synchronized ( this ) { if ( destroyed ) { return ; } for ( int i = 0 ; i < ngroups ; i ++ ) { if ( groups [ i ] == g ) { ngroups -= 1 ; System . arraycopy ( groups , i + 1 , groups , i , ngroups - i ) ; // Zap dangling reference to the dead group so that // the garbage collector will collect it. groups [ ngroups ] = null ; break ; } } if ( nthreads == 0 ) { notifyAll ( ) ; } if ( daemon && ( nthreads == 0 ) && ( nUnstartedThreads == 0 ) && ( ngroups == 0 ) ) { destroy ( ) ; } } }
Removes the specified Thread group from this group .