public static List < InetSocketAddress > getRPCAddresses ( String suffix , Configuration conf , Collection < String > serviceIds , String ... keys ) throws IOException { // Use default address as fall back String defaultAddress = null ; try { defaultAddress = conf . get ( FileSystem . FS_DEFAULT_NAME_KEY + suffix ) ; if ( defaultAddress != null ) { defaultAddress = NameNode . getDefaultAddress ( conf ) ; } } catch ( IllegalArgumentException e ) { defaultAddress = null ; } for ( int i = 0 ; i < keys . length ; i ++ ) { keys [ i ] += suffix ; } List < InetSocketAddress > addressList = DFSUtil . getAddresses ( conf , serviceIds , defaultAddress , keys ) ; if ( addressList == null ) { String keyStr = "" ; for ( String key : keys ) { keyStr += key + " " ; } throw new IOException ( "Incorrect configuration: namenode address " + keyStr + " is not configured." ) ; } return addressList ; }
Returns list of InetSocketAddresses corresponding to namenodes from the configuration .