public static InetAddress getPreferredIP ( InetAddress ep ) { String req = "SELECT preferred_ip FROM system.%s WHERE peer=?" ; UntypedResultSet result = executeInternal ( String . format ( req , PEERS_CF ) , ep ) ; if ( ! result . isEmpty ( ) && result . one ( ) . has ( "preferred_ip" ) ) return result . one ( ) . getInetAddress ( "preferred_ip" ) ; return ep ; }
Get preferred IP for given endpoint if it is known . Otherwise this returns given endpoint itself .