public static List < InetSocketAddress > getClientRpcAddresses ( Configuration conf , Collection < String > suffixes ) throws IOException { List < InetSocketAddress > addressList ; if ( suffixes != null && ! suffixes . isEmpty ( ) ) { addressList = new ArrayList < InetSocketAddress > ( ) ; for ( String s : suffixes ) { addressList . addAll ( getRPCAddresses ( s , conf , getNameServiceIds ( conf ) , FSConstants . DFS_NAMENODE_RPC_ADDRESS_KEY ) ) ; } } else { // Use default address as fall back String defaultAddress ; try { defaultAddress = NameNode . getDefaultAddress ( conf ) ; } catch ( IllegalArgumentException e ) { defaultAddress = null ; } addressList = getAddresses ( conf , defaultAddress , FSConstants . DFS_NAMENODE_RPC_ADDRESS_KEY ) ; } if ( addressList == null || addressList . isEmpty ( ) ) { throw new IOException ( "Incorrect configuration: namenode address " + FSConstants . DFS_NAMENODE_RPC_ADDRESS_KEY + " is not configured." ) ; } return addressList ; }
Returns list of InetSocketAddresses corresponding to namenodes from the configuration . Note this is to be used by clients to get the list of namenode addresses to talk to .