static List < HostSpec > getCandidateHosts ( HostSpec [ ] hostSpecs , HostRequirement targetServerType , long hostRecheckMillis ) { List < HostSpec > candidates = new ArrayList < HostSpec > ( hostSpecs . length ) ; long latestAllowedUpdate = currentTimeMillis ( ) - hostRecheckMillis ; synchronized ( hostStatusMap ) { for ( HostSpec hostSpec : hostSpecs ) { HostSpecStatus hostInfo = hostStatusMap . get ( hostSpec ) ; // candidates are nodes we do not know about and the nodes with correct type if ( hostInfo == null || hostInfo . lastUpdated < latestAllowedUpdate || targetServerType . allowConnectingTo ( hostInfo . status ) ) { candidates . add ( hostSpec ) ; } } } return candidates ; }
Returns a list of candidate hosts that have the required targetServerType .