private Node scanTerritory ( DistanceMap map , String desired , String supported ) { Node node ; for ( String partition : PARTITION_TABLE . getRegionPartition ( desired ) ) { node = map . get ( partition , supported ) ; if ( node != null ) { return node ; } } for ( String partition : PARTITION_TABLE . getRegionPartition ( supported ) ) { node = map . get ( desired , partition ) ; if ( node != null ) { return node ; } } return null ; }
Scan the desired region against the supported partitions and vice versa . Return the first matching node .