public void Add()

in RESTProxy/Models/TenantEndpointCollection.cs [64:93]


        public void Add(Endpoint endpoint)
        {
            // To maintain operational integrity, we don't want external entities to have
            // access to the endpoints being used when ProxyManager is running.  Therefore,
            // we will duplicate the endpoint being passed-in during configuration, and that
            // duplicate is what will be shared between our private dictionaries.
            Endpoint duplicatedEndpoint = endpoint.Duplicate();

            this.semaphore.Wait();
            try
            {
                List<Endpoint> typeEndpoints;
                if (this.EndpointsByType.TryGetValue(duplicatedEndpoint.Type, out typeEndpoints))
                {
                    typeEndpoints.Add(duplicatedEndpoint);
                    this.EndpointsByType[duplicatedEndpoint.Type] = typeEndpoints;
                }
                else
                {
                    typeEndpoints = new List<Endpoint>();
                    typeEndpoints.Add(duplicatedEndpoint);
                    this.EndpointsByType.Add(duplicatedEndpoint.Type, typeEndpoints);
                    this.NextEndpointIndex.Add(duplicatedEndpoint.Type, 0);
                }
            }
            finally
            {
                this.semaphore.Release();
            }
        }