// This server will fetch all primary data of sucessor and add it in his list of updates public void fetch_data(string predecessor_url) { IWorkerReplica predecessor = (IWorkerReplica)Activator.GetObject( typeof(IWorkerReplica), predecessor_url + "WorkerReplica"); List <ServerObject> fetched_data = predecessor.fetchData(); Replica.WORKERSERVEROBJECTS = fetched_data; }
// WARNING: This function is obsolete // The worker has a new predecessor (receives updates from a new one) public void setPredecessor(string predecessorURL) { IWorkerReplica predecessor = (IWorkerReplica)Activator.GetObject(typeof(IWorkerReplica), predecessorURL + "WorkerReplica"); List <ServerObject> backupObjects = predecessor.fetchData(); Replica.update(backupObjects); Console.WriteLine("AFTER SERVER FAILED MY PREDECESSOR IS = " + predecessor); Replica.PREDECESSOR = predecessorURL; }