private void ImAliveEvent(object source, ElapsedEventArgs e) { Logger.Log(new String[] { "BackupServer", Server.ID.ToString(), "ImAliveEvent" }); Console.WriteLine("PrimaryAddress: " + PrimaryAddress + " " + stateMessage); imAliveTimer.Stop(); //imAliveTimer.Close(); IServerMachine primaryServerMachine = (IServerMachine)Activator.GetObject(typeof(IServerMachine), PrimaryAddress + "Machine"); primaryServerMachine.RestartServer(); PrimaryServer.CreateBackupServer(Server.Address, padIntDictionary, true); //Server.CreatePrimaryServer(newBackupAddress, padIntDictionary, false); IMaster master = (IMaster)Activator.GetObject(typeof(IMaster), "tcp://localhost:8086/MasterServer"); master.UpdateServerAddress(Server.ID, Server.Address); }
internal BackupServer(Server server, string primaryAddress, Dictionary <int, IPadInt> pdInts) : base(server, pdInts) { PrimaryAddress = primaryAddress; PrimaryServer = (IServer)Activator.GetObject(typeof(IServer), primaryAddress); PrimaryServer.CreatePrimaryServer(Server.Address, padIntDictionary, false); // Create a timer with inAliveInterval second interval. imAliveTimer = new PadIntTimer(IM_ALIVE_INTERVAL); imAliveTimer.Timer.Elapsed += new ElapsedEventHandler(ImAliveEvent); //starts im alive timer imAliveTimer.Start(); StateMsg = "BACKUP STATE"; }