public void AddAgent(Guid agentId, Process process) { lock (LOCK) { if (_agentIndex.ContainsKey(agentId)) { throw new ArgumentException($"An agent has already been started with the ID '{agentId}'.", nameof(agentId)); } _agentIndex[agentId] = _processIndex[process] = AgentRecord.Starting(agentId, process); } }
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)); } }