public static boolean isDefaultNamenodeAddress ( Configuration conf , InetSocketAddress address , String ... keys ) { for ( String key : keys ) { String candidateAddress = conf . get ( key ) ; if ( candidateAddress != null && address . equals ( NetUtils . createSocketAddr ( candidateAddress ) ) ) return true ; } return false ; }
Given the InetSocketAddress for any configured communication with a namenode this method determines whether it is the configured communication channel for the default namenode . It does a reverse lookup on the list of default communication parameters to see if the given address matches any of them . Since the process of resolving URIs to Addresses is slightly expensive this utility method should not be used in performance - critical routines .