public void RequestStopDatabase(Guid databaseGuid, HangDetector hangDetector)
 {
     lock (this.assistantDrivers)
     {
         if (this.assistantDrivers.ContainsKey(databaseGuid))
         {
             TimeBasedDatabaseDriver timeBasedDatabaseDriver = this.assistantDrivers[databaseGuid];
             ExTraceGlobals.TimeBasedAssistantControllerTracer.TraceDebug <TimeBasedAssistantController, TimeBasedDatabaseDriver>((long)this.GetHashCode(), "{0}: Requesting stop of {1}", this, timeBasedDatabaseDriver);
             try
             {
                 if (timeBasedDatabaseDriver != null)
                 {
                     if (hangDetector != null)
                     {
                         hangDetector.AssistantName = timeBasedDatabaseDriver.Assistant.NonLocalizedName;
                     }
                     timeBasedDatabaseDriver.RequestStop();
                 }
                 goto IL_8A;
             }
             finally
             {
                 if (hangDetector != null)
                 {
                     hangDetector.AssistantName = "Common Code";
                 }
             }
         }
         ExTraceGlobals.TimeBasedAssistantControllerTracer.TraceDebug <TimeBasedAssistantController, Guid>((long)this.GetHashCode(), "{0}: No driver found for database {1}, no need to request stop", this, databaseGuid);
         IL_8A :;
     }
 }
Exemple #2
0
 // Token: 0x060001F2 RID: 498 RVA: 0x0000A370 File Offset: 0x00008570
 public void RequestStop(HangDetector hangDetector)
 {
     EventController.ShutdownState shutdownState = (EventController.ShutdownState)Interlocked.CompareExchange(ref this.shutdownState, 1, 0);
     AIBreadcrumbs.ShutdownTrail.Drop(string.Concat(new object[]
     {
         "Previous shutdown state: ",
         shutdownState,
         ". Current: ",
         this.shutdownState.ToString()
     }));
     if (shutdownState == EventController.ShutdownState.NotRequested)
     {
         base.TracePfd("PFD AIS {0} {1}: phase1 shutdown", new object[]
         {
             27735,
             this
         });
         if (this.timer != null)
         {
             this.timer.Dispose();
             this.timer = null;
         }
         this.assistants.ShutdownAssistants(hangDetector);
     }
 }
 public void RequestStop(HangDetector hangDetector)
 {
     ExTraceGlobals.TimeBasedAssistantControllerTracer.TraceDebug <TimeBasedAssistantController>((long)this.GetHashCode(), "{0}: Stopping", this);
     AssistantsRpcServer.DeregisterAssistant(this.timeBasedAssistantType.NonLocalizedName);
     if (this.workCycleConfigurationTimer != null)
     {
         this.workCycleConfigurationTimer.Dispose();
         this.workCycleConfigurationTimer = null;
     }
     this.DeinitializeTimer();
     lock (this.assistantDrivers)
     {
         foreach (TimeBasedDatabaseDriver timeBasedDatabaseDriver in this.assistantDrivers.Values)
         {
             if (timeBasedDatabaseDriver != null)
             {
                 if (hangDetector != null)
                 {
                     hangDetector.AssistantName = timeBasedDatabaseDriver.Assistant.NonLocalizedName;
                 }
                 try
                 {
                     timeBasedDatabaseDriver.RequestStop();
                 }
                 finally
                 {
                     if (hangDetector != null)
                     {
                         hangDetector.AssistantName = "Common Code";
                     }
                 }
             }
         }
     }
 }
Exemple #4
0
 public void RequestStopDatabase(Guid databaseGuid, HangDetector hangDetector)
 {
     ExTraceGlobals.TimeBasedDriverManagerTracer.TraceDebug <TimeBasedDriverManager, Guid>((long)this.GetHashCode(), "{0}: Requesting stop of assistants for database {1}", this, databaseGuid);
     foreach (TimeBasedAssistantControllerWrapper timeBasedAssistantControllerWrapper in this.TimeBasedAssistantControllerArray)
     {
         timeBasedAssistantControllerWrapper.Controller.RequestStopDatabase(databaseGuid, hangDetector);
     }
 }
Exemple #5
0
        // Token: 0x06000196 RID: 406 RVA: 0x0000859C File Offset: 0x0000679C
        private void RemoveAllOnlineDatabases(HangDetector hangDetector)
        {
            AIBreadcrumbs.DatabaseStatusTrail.Drop("Removing all online databases.");
            List <Guid> list = new List <Guid>();

            lock (this)
            {
                list.AddRange(this.onlineDatabases.Keys);
                foreach (Guid databaseGuid in list)
                {
                    this.RemoveDatabase(databaseGuid, hangDetector);
                }
            }
        }
Exemple #6
0
 public void RequestStop(HangDetector hangDetector)
 {
     ExTraceGlobals.TimeBasedDriverManagerTracer.TraceDebug <TimeBasedDriverManager>((long)this.GetHashCode(), "{0}: Stopping", this);
     if (this.rpcServerStarted)
     {
         AssistantsRpcServerBase.StopServer();
         this.rpcServerStarted = false;
     }
     foreach (TimeBasedAssistantControllerWrapper timeBasedAssistantControllerWrapper in this.TimeBasedAssistantControllerArray)
     {
         AIBreadcrumbs.ShutdownTrail.Drop("Stopping controller: " + timeBasedAssistantControllerWrapper.Controller.TimeBasedAssistantType);
         timeBasedAssistantControllerWrapper.Controller.RequestStop(hangDetector);
         SystemWorkloadManager.UnregisterWorkload(timeBasedAssistantControllerWrapper);
         AIBreadcrumbs.ShutdownTrail.Drop("Finished stopping " + timeBasedAssistantControllerWrapper.Controller.TimeBasedAssistantType);
     }
 }
Exemple #7
0
        // Token: 0x06000197 RID: 407 RVA: 0x00008638 File Offset: 0x00006838
        private void CheckForRestart(HangDetector hangDetector)
        {
            List <Guid> list = new List <Guid>();

            foreach (KeyValuePair <Guid, OnlineDatabase> keyValuePair in this.onlineDatabases)
            {
                if (keyValuePair.Value.RestartRequired)
                {
                    list.Add(keyValuePair.Key);
                }
            }
            foreach (Guid databaseGuid in list)
            {
                this.RemoveDatabase(databaseGuid, hangDetector);
            }
        }
Exemple #8
0
 public void RequestStop(HangDetector hangDetector)
 {
     ExTraceGlobals.OnlineDatabaseTracer.TraceDebug <OnlineDatabase>((long)this.GetHashCode(), "{0}: Requesting stop", this);
     if (this.eventController != null)
     {
         this.eventController.RequestStop(hangDetector);
     }
     if (this.databaseManager.TimeBasedDriverManager != null)
     {
         this.databaseManager.TimeBasedDriverManager.RequestStopDatabase(this.databaseInfo.Guid, hangDetector);
     }
     base.TracePfd("PFD AIS {0} {1}: Stop requested", new object[]
     {
         28759,
         this
     });
 }
 public void ShutdownAssistants(HangDetector hangDetector)
 {
     foreach (AssistantCollectionEntry assistantCollectionEntry in this.listOfAssistants)
     {
         try
         {
             if (assistantCollectionEntry != null)
             {
                 AIBreadcrumbs.ShutdownTrail.Drop("Stopping event assistant " + assistantCollectionEntry.Name);
                 hangDetector.AssistantName = assistantCollectionEntry.Name;
                 assistantCollectionEntry.Shutdown();
                 AIBreadcrumbs.ShutdownTrail.Drop("Finished stopping " + assistantCollectionEntry.Name);
             }
         }
         finally
         {
             hangDetector.AssistantName = "Common Code";
         }
     }
 }
Exemple #10
0
        // Token: 0x06000199 RID: 409 RVA: 0x00008810 File Offset: 0x00006A10
        private void RemoveDatabase(Guid databaseGuid, HangDetector hangDetector)
        {
            AIBreadcrumbs.DatabaseStatusTrail.Drop("Removing database " + databaseGuid);
            OnlineDatabase onlineDatabase = this.onlineDatabases[databaseGuid];

            hangDetector.DatabaseName = ((onlineDatabase == null || onlineDatabase.DatabaseInfo == null) ? null : onlineDatabase.DatabaseInfo.DisplayName);
            this.onlineDatabases.Remove(databaseGuid);
            try
            {
                onlineDatabase.Stop(hangDetector);
                base.LogEvent(AssistantsEventLogConstants.Tuple_DatabaseManagerStoppedDatabase, null, new object[]
                {
                    onlineDatabase.DatabaseInfo.DisplayName
                });
            }
            finally
            {
                onlineDatabase.Dispose();
                hangDetector.DatabaseName = null;
            }
        }
Exemple #11
0
 public void Stop(HangDetector hangDetector)
 {
     this.RequestStop(hangDetector);
     this.WaitUntilStopped();
 }
Exemple #12
0
 // Token: 0x06000193 RID: 403 RVA: 0x0000823C File Offset: 0x0000643C
 private void CheckDatabaseStatus(HangDetector hangDetector)
 {
     try
     {
         long timestamp = Stopwatch.GetTimestamp();
         if (ExTraceGlobals.FaultInjectionTracer.IsTraceEnabled(TraceType.FaultInjection))
         {
             ExTraceGlobals.FaultInjectionTracer.TraceTest <long>(2370186557U, ref timestamp);
         }
         this.performanceCountersTotal.ElapsedTimeSinceLastDatabaseStatusUpdateAttempt.RawValue = timestamp;
         lock (this)
         {
             if (this.startState != DatabaseManager.StartState.Initialized)
             {
                 ExTraceGlobals.DatabaseManagerTracer.TraceDebug <DatabaseManager>((long)this.GetHashCode(), "{0}: CheckDatabaseStatus called when not initialized.", this);
                 return;
             }
             AIBreadcrumbs.DatabaseStatusTrail.Drop("Checking if Store is running.");
             if (!this.IsStoreServiceRunning())
             {
                 ExTraceGlobals.DatabaseManagerTracer.TraceDebug <DatabaseManager>((long)this.GetHashCode(), "{0}: Store is not running, cannot check status of databases. Assuming all databases are dismounted.", this);
                 this.RemoveAllOnlineDatabases(hangDetector);
                 return;
             }
             this.CheckForRestart(hangDetector);
         }
         base.CatchMeIfYouCan(delegate
         {
             if (this.exRpcAdmin == null)
             {
                 AIBreadcrumbs.DatabaseStatusTrail.Drop("Creating ExRpcAdmin.");
                 this.exRpcAdmin = ExRpcAdmin.Create("Client=EBA", null, null, null, null);
             }
             MdbStatus[] array = this.GetOnlineDatabases();
             lock (this)
             {
                 List <Guid> list = new List <Guid>();
                 foreach (Guid guid in this.onlineDatabases.Keys)
                 {
                     if (!DatabaseManager.IsOnlineDatabase(guid, array))
                     {
                         list.Add(guid);
                     }
                 }
                 foreach (Guid databaseGuid in list)
                 {
                     this.RemoveDatabase(databaseGuid, hangDetector);
                 }
                 foreach (MdbStatus mdbStatus in array)
                 {
                     if (this.isStopping)
                     {
                         break;
                     }
                     if (!this.onlineDatabases.ContainsKey(mdbStatus.MdbGuid))
                     {
                         this.TracePfd("PFD AIS {0} {1}: found new online database '{2}'", new object[]
                         {
                             17239,
                             this,
                             mdbStatus.MdbName
                         });
                         AIBreadcrumbs.DatabaseStatusTrail.Drop("Adding database " + mdbStatus.MdbGuid);
                         DatabaseInfo databaseInfo = this.TryCreateDatabaseInfo(mdbStatus);
                         if (databaseInfo != null)
                         {
                             this.AttemptAddDatabase(databaseInfo);
                         }
                     }
                 }
             }
         }, "DatabaseManager");
     }
     catch (AIException ex)
     {
         ExTraceGlobals.DatabaseManagerTracer.TraceError <DatabaseManager, AIException>((long)this.GetHashCode(), "{0}: Failed to process databases. Exception={1}", this, ex);
         base.LogEvent(AssistantsEventLogConstants.Tuple_DatabaseManagerTransientFailure, ex.ToString(), new object[]
         {
             ex.ToString()
         });
         if (this.exRpcAdmin != null)
         {
             this.exRpcAdmin.Dispose();
             this.exRpcAdmin = null;
         }
         if (!(ex is AITransientException))
         {
             this.RemoveAllOnlineDatabases(hangDetector);
         }
     }
 }