public void addServerToView(String serverid, String serverurl) { //prevent deadlock if (!server.getView().ContainsKey(serverid)) { lock (server) { Console.WriteLine("-------- BEGIN VIEW UPDATE --------"); server.updateView("add", serverid, serverurl); Console.WriteLine("Server added: " + serverid + " @ " + serverurl); String backupInfo = server.getBackupServer()[0]; for (int i = 1; i < server.getBackupServer().Length; i++) { backupInfo += ", " + server.getBackupServer()[i]; } Console.WriteLine("New Backup-URL: " + backupInfo); if (!server.getBackupServer().Equals(server.getURL())) { ServerCli bscli = (ServerCli)Activator.GetObject(typeof(ServerCli), server.getBackupServer()[0]); bscli.addServerToView(serverid, serverurl); } //send command to update backup server to clients foreach (IClient client in clientsList) { client.setBackupServerURL(server.getBackupServer()); } //recreate BackupProposals recreateBackupProposals(); Console.WriteLine("Backup server in " + clientsList.Count + " client(s) updated."); Console.WriteLine("--------- END VIEW UPDATE ---------"); } } }
public void addServerToView(String serverid, String serverurl) { sc.addServerToView(serverid, serverurl); }