read the ribbon source code and find that ribbon uses the strange method of adding servers like addAll when adding servers. I don"t understand why I do this. Is there a boss who can explain it?
public void addServer(Server newServer) {
if (newServer != null) {
try {
ArrayList<Server> newList = new ArrayList<Server>();
newList.addAll(allServerList);
newList.add(newServer);
setServersList(newList);
} catch (Exception e) {
logger.error("Exception while adding a newServer", e);
}
}
}
some doubts:
Why can"t you update with add ()? For concurrency situations, it seems that you can consider using concurrent locks for processing, which seems to have higher performance. I hope someone can answer this question.