DecommissionStatus generateDecommissioningReport ( ) { List < InetSocketAddress > isas = null ; ArrayList < String > suffixes = null ; if ( isAvatar ) { suffixes = new ArrayList < String > ( ) ; suffixes . add ( "0" ) ; suffixes . add ( "1" ) ; } try { isas = DFSUtil . getClientRpcAddresses ( conf , suffixes ) ; sort ( isas ) ; } catch ( Exception e ) { // catch any exception encountered other than connecting to namenodes DecommissionStatus dInfo = new DecommissionStatus ( e ) ; LOG . error ( e ) ; return dInfo ; } // Outer map key is datanode. Inner map key is namenode and the value is // decom status of the datanode for the corresponding namenode Map < String , Map < String , String > > statusMap = new HashMap < String , Map < String , String > > ( ) ; // Map of exceptions encountered when connecting to namenode // key is namenode and value is exception Map < String , Exception > decommissionExceptions = new HashMap < String , Exception > ( ) ; List < String > unreportedNamenode = new ArrayList < String > ( ) ; DecommissionStatusFetcher [ ] threads = new DecommissionStatusFetcher [ isas . size ( ) ] ; for ( int i = 0 ; i < isas . size ( ) ; i ++ ) { threads [ i ] = new DecommissionStatusFetcher ( isas . get ( i ) , statusMap ) ; threads [ i ] . start ( ) ; } for ( DecommissionStatusFetcher thread : threads ) { try { thread . join ( ) ; if ( thread . e != null ) { // catch exceptions encountered while connecting to namenodes decommissionExceptions . put ( thread . isa . toString ( ) , thread . e ) ; unreportedNamenode . add ( thread . isa . toString ( ) ) ; } } catch ( InterruptedException ex ) { LOG . warn ( ex ) ; } } updateUnknownStatus ( statusMap , unreportedNamenode ) ; getDecommissionNodeClusterState ( statusMap ) ; return new DecommissionStatus ( statusMap , isas , getDatanodeHttpPort ( conf ) , decommissionExceptions ) ; }
Helper function that generates the decommissioning report .