public static Map < InetAddress , Map < String , String > > loadDcRackInfo ( ) { Map < InetAddress , Map < String , String > > result = new HashMap < InetAddress , Map < String , String > > ( ) ; for ( UntypedResultSet . Row row : executeInternal ( "SELECT peer, data_center, rack from system." + PEERS_CF ) ) { InetAddress peer = row . getInetAddress ( "peer" ) ; if ( row . has ( "data_center" ) && row . has ( "rack" ) ) { Map < String , String > dcRack = new HashMap < String , String > ( ) ; dcRack . put ( "data_center" , row . getString ( "data_center" ) ) ; dcRack . put ( "rack" , row . getString ( "rack" ) ) ; result . put ( peer , dcRack ) ; } } return result ; }
Return a map of IP addresses containing a map of dc and rack info