Ejemplo n.º 1
0
        static InstrumentationManager()
        {
            const string method = "InstrumentationManager";

            try
            {
                // Create members.

                Lock                 = new ReaderWriterLock();
                SourceStates         = new Hashtable();
                Events               = new Hashtable();
                EventDetailFactories = new EventDetailFactories();

                // Initialise.

                InitialiseDefaults();

                // Initialise internal message handler.

                InitialiseInternalMessageHandler();

                var message = GenerateInitialiseMessage();
                _internalMessageHandler.HandleEventMessage(message);

                // Now initialise everything.

                var container = new UnityContainer();
                container.AddConfiguration("linkme.instrumentation.container");

                InitialiseRootMessageHandler(container, message);
                InitialiseEventDetails();
                _catalogue = GetCatalogue(container);
                if (_catalogue != null)
                {
                    InitialiseEvents(_catalogue);
                }
            }
            catch (Exception ex)
            {
                if (_internalMessageHandler != null)
                {
                    _internalMessageHandler.HandleEventMessage(new EventMessage(null, Event.Error, typeof(InstrumentationManager), method, string.Format("Failed to initialise the Instrumentation module: {0}{1}", Environment.NewLine, ex)));
                }
            }
            finally
            {
                Initialised = true;
            }
        }