@ Override // NameNodeMXBean public String getLiveNodes ( ) { final Map < String , Map < String , Object > > info = new HashMap < String , Map < String , Object > > ( ) ; try { final ArrayList < DatanodeDescriptor > liveNodeList = new ArrayList < DatanodeDescriptor > ( ) ; final ArrayList < DatanodeDescriptor > deadNodeList = new ArrayList < DatanodeDescriptor > ( ) ; DFSNodesStatus ( liveNodeList , deadNodeList ) ; removeDecommissionedNodeFromList ( liveNodeList ) ; for ( DatanodeDescriptor node : liveNodeList ) { final Map < String , Object > innerinfo = new HashMap < String , Object > ( ) ; innerinfo . put ( "lastContact" , getLastContact ( node ) ) ; innerinfo . put ( "usedSpace" , getDfsUsed ( node ) ) ; innerinfo . put ( "adminState" , node . getAdminState ( ) . toString ( ) ) ; innerinfo . put ( "excluded" , this . inExcludedHostsList ( node , null ) ) ; info . put ( node . getHostName ( ) + ":" + node . getPort ( ) , innerinfo ) ; } } catch ( Exception e ) { LOG . error ( "Exception:" , e ) ; } return JSON . toString ( info ) ; }
Returned information is a JSON representation of map with host name as the key and value is a map of live node attribute keys to its values