public static List < InetSocketAddress > getAddresses ( Configuration conf , Collection < String > serviceIds , String defaultAddress , String ... keys ) { Collection < String > nameserviceIds = getNameServiceIds ( conf ) ; List < InetSocketAddress > isas = new ArrayList < InetSocketAddress > ( ) ; // Configuration with a single namenode if ( nameserviceIds == null || nameserviceIds . isEmpty ( ) ) { String address = getConfValue ( defaultAddress , null , conf , keys ) ; if ( address == null ) { return null ; } isas . add ( NetUtils . createSocketAddr ( address ) ) ; } else { // Get the namenodes for all the configured nameServiceIds for ( String nameserviceId : nameserviceIds ) { String address = getConfValue ( null , nameserviceId , conf , keys ) ; if ( address == null ) { return null ; } isas . add ( NetUtils . createSocketAddr ( address ) ) ; } } return isas ; }
Return list of InetSocketAddress for a given set of services