@ Override public URL select ( List < URL > urls , String requestKey ) { // search for a URL in the same ip first List < URL > localUrls = searchLocalUrls ( urls , ip ) ; if ( localUrls . size ( ) > 0 ) { if ( localUrls . size ( ) == 1 ) { return localUrls . get ( 0 ) ; } else { // round robin within localUrls return doSelect ( localUrls ) ; } } else { // round robin within urls return doSelect ( urls ) ; } }
Local first requestKey is not used as it is ip on the localhost . It first needs to find a list of urls on the localhost for the service and then round robin in the list to pick up one .