public void Add(AgentRecord r) { lock (_lock) { _agentData[r.Id] = r; } }
public void Add(AgentRecord r) { lock (agentData) { agentData[r.Id] = r; } }
//public override void Stop() //{ // foreach( KeyValuePair<Guid,AgentRecord> pair in agentData ) // { // AgentRecord r = pair.Value; // if ( !r.Process.HasExited ) // { // if ( r.Agent != null ) // { // r.Agent.Stop(); // r.Process.WaitForExit(10000); // } // if ( !r.Process.HasExited ) // r.Process.Kill(); // } // } // agentData.Clear(); // base.Stop (); //} #endregion #region Public Methods - Called by Agents public void Register(ITestAgent agent) { AgentRecord r = _agentData[agent.Id]; if (r == null) { throw new ArgumentException( string.Format("Agent {0} is not in the agency database", agent.Id), "agentId"); } r.Agent = agent; }
public void AddAgent(Guid agentId, Process process) { lock (_agentsById) { if (_agentsById.ContainsKey(agentId)) { throw new ArgumentException($"An agent has already been started with the ID '{agentId}'.", nameof(agentId)); } _agentsById.Add(agentId, AgentRecord.Starting(process)); } }
public void ReportStatus(Guid agentId, AgentStatus status) { AgentRecord r = _agentData[agentId]; if (r == null) { throw new ArgumentException( string.Format("Agent {0} is not in the agency database", agentId), "agentId"); } r.Status = status; }
public void ReleaseAgent(ITestAgent agent) { AgentRecord r = _agentData[agent.Id]; if (r == null) { log.Error(string.Format("Unable to release agent {0} - not in database", agent.Id)); } else { r.Status = AgentStatus.Ready; log.Debug("Releasing agent " + agent.Id.ToString()); } }
public AgentRecord this[ITestAgent agent] { get { foreach (KeyValuePair <Guid, AgentRecord> entry in agentData) { AgentRecord r = entry.Value; if (r.Agent == agent) { return(r); } } return(null); } }