public static EventBasedAssistantCollection Create(DatabaseInfo databaseInfo, AssistantType[] assistantTypes)
        {
            EventBasedAssistantCollection eventBasedAssistantCollection = new EventBasedAssistantCollection(databaseInfo, assistantTypes);

            if (eventBasedAssistantCollection.Count == 0)
            {
                eventBasedAssistantCollection.Dispose();
                return(null);
            }
            return(eventBasedAssistantCollection);
        }
        internal static EventBasedAssistantCollection CreateForTest(DatabaseInfo databaseInfo, IEventBasedAssistantType[] eventBasedAssistantTypes)
        {
            PerformanceCountersPerAssistantInstance performanceCountersPerAssistantsTotal = new PerformanceCountersPerAssistantInstance("TestAssistant-Total", null);

            AssistantType[] assistantTypes = AssistantType.CreateArray(eventBasedAssistantTypes, performanceCountersPerAssistantsTotal);
            EventBasedAssistantCollection eventBasedAssistantCollection = new EventBasedAssistantCollection(databaseInfo, assistantTypes);

            if (eventBasedAssistantCollection.Count == 0)
            {
                eventBasedAssistantCollection.Dispose();
                return(null);
            }
            return(eventBasedAssistantCollection);
        }
Exemple #3
0
        public void Start()
        {
            ExTraceGlobals.OnlineDatabaseTracer.TraceDebug <OnlineDatabase>((long)this.GetHashCode(), "{0}: Starting", this);
            bool flag  = false;
            bool flag2 = false;
            bool flag3 = false;
            EventBasedAssistantCollection eventBasedAssistantCollection = null;

            try
            {
                PoisonEventControl   poisonControl  = new PoisonEventControl(this.databaseManager.PoisonControlMaster, this.DatabaseInfo);
                PoisonMailboxControl poisonControl2 = new PoisonMailboxControl(this.databaseManager.PoisonControlMaster, this.DatabaseInfo);
                string text = this.databaseManager.ServiceName + "-" + this.DatabaseInfo.DatabaseName;
                ExTraceGlobals.OnlineDatabaseTracer.TraceDebug <OnlineDatabase, string>((long)this.GetHashCode(), "{0}: Creating performance counters instance {1}", this, text);
                this.performanceCounters = new PerformanceCountersPerDatabaseInstance(text, this.databaseManager.PerformanceCountersTotal);
                this.performanceCounters.Reset();
                if (this.databaseManager.AssistantTypes != null)
                {
                    eventBasedAssistantCollection = EventBasedAssistantCollection.Create(this.databaseInfo, this.databaseManager.AssistantTypes);
                    if (eventBasedAssistantCollection != null)
                    {
                        if (this.databaseInfo.IsPublic)
                        {
                            this.eventController = new EventControllerPublic(this.databaseInfo, eventBasedAssistantCollection, poisonControl, this.performanceCounters, this.databaseManager.EventGovernor);
                        }
                        else
                        {
                            this.eventController = new EventControllerPrivate(this.databaseInfo, eventBasedAssistantCollection, poisonControl, this.performanceCounters, this.databaseManager.EventGovernor);
                        }
                        eventBasedAssistantCollection = null;
                        this.eventController.Start();
                        flag2 = true;
                    }
                }
                if (!this.databaseInfo.IsPublic && this.databaseManager.TimeBasedDriverManager != null)
                {
                    this.databaseManager.TimeBasedDriverManager.StartDatabase(this.databaseInfo, poisonControl2, this.performanceCounters);
                    flag3 = true;
                }
                flag = true;
            }
            finally
            {
                if (eventBasedAssistantCollection != null)
                {
                    eventBasedAssistantCollection.Dispose();
                }
                if (!flag)
                {
                    ExTraceGlobals.OnlineDatabaseTracer.TraceError <OnlineDatabase>((long)this.GetHashCode(), "{0}: unable to start", this);
                    if (this.eventController != null)
                    {
                        if (flag2)
                        {
                            this.eventController.Stop();
                        }
                        this.eventController.Dispose();
                        this.eventController = null;
                    }
                }
                if (!flag3 && !flag2)
                {
                    this.DisposePerformanceCounters();
                }
            }
            base.TracePfd("PFS AIS {0} {1}: Started", new object[]
            {
                20567,
                this
            });
        }