protected HttpURLConnection openConnection ( String path , String query ) throws IOException { try { final URL url = new URI ( "http" , null , nnAddr . getAddress ( ) . getHostAddress ( ) , nnAddr . getPort ( ) , path , query , null ) . toURL ( ) ; if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "url=" + url ) ; } return ( HttpURLConnection ) url . openConnection ( ) ; } catch ( URISyntaxException e ) { throw ( IOException ) new IOException ( ) . initCause ( e ) ; } }
Open an HTTP connection to the namenode to read file data and metadata .