/** * Creates a list of possible destinations for a region. It contains the online servers, but not * the draining or dying servers. * @param serverToExclude can be null if there is no server to exclude */ public List<ServerName> createDestinationServersList(final ServerName serverToExclude){ final List<ServerName> destServers = getOnlineServersList(); if (serverToExclude != null){ destServers.remove(serverToExclude); } // Loop through the draining server list and remove them from the server list final List<ServerName> drainingServersCopy = getDrainingServersList(); if (!drainingServersCopy.isEmpty()) { for (final ServerName server: drainingServersCopy) { destServers.remove(server); } } // Remove the deadNotExpired servers from the server list. removeDeadNotExpiredServers(destServers); return destServers; }