/// <summary> /// Create a PadInt identified by uid /// </summary> /// <param name="uid">PadInt identifier</param> /// <returns></returns> internal override bool CreatePadInt(int uid) { Logger.Log(new String[] { "PrimaryServer", Server.ID.ToString(), "createPadInt", "uid ", uid.ToString(), " NPadInts", (padIntDictionary.Count + 1).ToString() }); try { padIntDictionary.Add(uid, new PadInt(uid)); /* updates the backup server */ backupReplyTimer.Start(); BackupServer.CreatePadInt(uid); backupReplyTimer.Stop(); return(true); } catch (ArgumentException) { throw new PadIntAlreadyExistsException(uid, Server.ID); } }
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"; }
internal PrimaryServer(Server server, String backupAddress, Dictionary <int, IPadInt> pdInts) : base(server, pdInts) { BackupAddress = backupAddress; BackupServer = (IServer)Activator.GetObject(typeof(IServer), backupAddress); // Create a timer with IM_ALIVE_INTERVAL second interval. imAliveTimer = new PadIntTimer(IM_ALIVE_INTERVAL); imAliveTimer.Timer.Elapsed += new ElapsedEventHandler(ImAliveEvent); // Create a timer with BACKUP_REPLY_INTERVAL second interval. backupReplyTimer = new PadIntTimer(BACKUP_REPLY_INTERVAL); backupReplyTimer.Timer.Elapsed += new ElapsedEventHandler(BackupReplyEvent); //starts im alive timer imAliveTimer.Start(); StateMsg = "PRIMARY STATE"; }