private ArrayList < Thread > getActiveThreads ( int namespaceId , Block block ) { lock . writeLock ( ) . lock ( ) ; try { //check ongoing create threads final ActiveFile activefile = volumeMap . getOngoingCreates ( namespaceId , block ) ; if ( activefile != null && ! activefile . threads . isEmpty ( ) ) { //remove dead threads for ( Iterator < Thread > i = activefile . threads . iterator ( ) ; i . hasNext ( ) ; ) { final Thread t = i . next ( ) ; if ( ! t . isAlive ( ) ) { i . remove ( ) ; } } //return living threads if ( ! activefile . threads . isEmpty ( ) ) { return new ArrayList < Thread > ( activefile . threads ) ; } } } finally { lock . writeLock ( ) . unlock ( ) ; } return null ; }
Return a list of active writer threads for the given block .