Appccelerate.EventBroker.Internals.EventTopicHost.GetEventTopic C# (CSharp) Method

GetEventTopic() public method

Gets a event topic. Result is never null. Event topic is created if it does not yet exist.
Returns a non null instance of the dictionary.
public GetEventTopic ( string topic ) : IEventTopic
topic string The topic URI identifying the event topic to return.
return IEventTopic
        public IEventTopic GetEventTopic(string topic)
        {
            if (this.eventTopics.ContainsKey(topic))
            {
                return this.eventTopics[topic];
            }

            lock (this)
            {
                // recheck inside monitor
                if (this.eventTopics.ContainsKey(topic))
                {
                    return this.eventTopics[topic];
                }

                IEventTopic eventTopic = this.factory.CreateEventTopicInternal(topic, this.globalMatchersProvider);

                // copy
                this.eventTopics = new Dictionary<string, IEventTopic>(this.eventTopics) { { topic, eventTopic } };

                this.extensionHost.ForEach(extension => extension.CreatedTopic(eventTopic));

                return eventTopic;
            }
        }