예제 #1
0
        // Token: 0x06002399 RID: 9113 RVA: 0x000A7154 File Offset: 0x000A5354
        public static void StopMonitoredDatabase(string dbGuidStr)
        {
            MonitoredDatabase monitoredDatabase = null;

            lock (RemoteDataProvider.s_singletonLock)
            {
                if (RemoteDataProvider.s_databases.TryGetInstance(dbGuidStr, out monitoredDatabase) && monitoredDatabase != null)
                {
                    RemoteDataProvider.s_databases.RemoveInstance(monitoredDatabase);
                }
            }
            if (monitoredDatabase != null)
            {
                monitoredDatabase.StopMonitoring();
                return;
            }
            RemoteDataProvider.Tracer.TraceDebug <string>(0L, "StopMonitoredDatabase found no database for {0}", dbGuidStr);
        }
예제 #2
0
        // Token: 0x06002398 RID: 9112 RVA: 0x000A6E5C File Offset: 0x000A505C
        public static void MonitorDatabases(List <string> databasesToStopMonitoring, List <string> databasesToRestartMonitoring, Dictionary <string, ReplayConfiguration> configurationsFound)
        {
            List <MonitoredDatabase> list = new List <MonitoredDatabase>(databasesToStopMonitoring.Count);

            lock (RemoteDataProvider.s_singletonLock)
            {
                if (RemoteDataProvider.s_tprEnabled)
                {
                    return;
                }
                MonitoredDatabase[] allInstances = RemoteDataProvider.s_databases.GetAllInstances();
                foreach (MonitoredDatabase monitoredDatabase in allInstances)
                {
                    if (databasesToStopMonitoring.Contains(monitoredDatabase.Identity))
                    {
                        ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug <string>(0L, "Config for MonitoredDatabase is gone: {0}", monitoredDatabase.Config.DatabaseName);
                        SourceSeedTable.Instance.CancelSeedingIfAppropriate(SourceSeedTable.CancelReason.CopyRemoved, monitoredDatabase.DatabaseGuid);
                        list.Add(monitoredDatabase);
                        RemoteDataProvider.s_databases.RemoveInstance(monitoredDatabase);
                    }
                }
                foreach (KeyValuePair <string, ReplayConfiguration> keyValuePair in configurationsFound)
                {
                    ReplayConfiguration value = keyValuePair.Value;
                    bool flag2 = value.Type == ReplayConfigType.RemoteCopySource;
                    bool flag3 = flag2 || (value.Type == ReplayConfigType.RemoteCopyTarget && !value.ReplayState.Suspended);
                    MonitoredDatabase monitoredDatabase2 = null;
                    if (RemoteDataProvider.s_databases.TryGetInstance(value.Identity, out monitoredDatabase2))
                    {
                        if (flag3 && !databasesToRestartMonitoring.Contains(monitoredDatabase2.Identity))
                        {
                            RemoteDataProvider.Tracer.TraceDebug <string>((long)monitoredDatabase2.GetHashCode(), "Config not changed, or the associated RI was not restarted. Continuing to monitor: {0}", value.DatabaseName);
                            continue;
                        }
                        RemoteDataProvider.Tracer.TraceDebug <string>((long)monitoredDatabase2.GetHashCode(), "Config for MonitoredDatabase is changing or a restart was requested: {0}", value.DatabaseName);
                        SourceSeedTable.Instance.CancelSeedingIfAppropriate(SourceSeedTable.CancelReason.ConfigChanged, monitoredDatabase2.DatabaseGuid);
                        list.Add(monitoredDatabase2);
                    }
                    if (!flag2)
                    {
                        RemoteDataProvider.Tracer.TraceDebug <string>(0L, "Not starting monitor for {0}", value.DatabaseName);
                        if (monitoredDatabase2 != null)
                        {
                            RemoteDataProvider.s_databases.RemoveInstance(monitoredDatabase2);
                        }
                    }
                    else
                    {
                        if (monitoredDatabase2 != null && !monitoredDatabase2.IsPassiveCopy)
                        {
                            monitoredDatabase2.StopMonitoring();
                        }
                        MonitoredDatabase monitoredDatabase3 = new MonitoredDatabase(value);
                        if (monitoredDatabase3.StartMonitoring() == null)
                        {
                            if (monitoredDatabase2 != null)
                            {
                                RemoteDataProvider.s_databases.UpdateInstance(monitoredDatabase2, monitoredDatabase3);
                            }
                            else
                            {
                                RemoteDataProvider.s_databases.AddInstance(monitoredDatabase3);
                            }
                            RemoteDataProvider.Tracer.TraceDebug <string>((long)monitoredDatabase3.GetHashCode(), "Now monitoring: {0}", value.DatabaseName);
                        }
                        else
                        {
                            RemoteDataProvider.Tracer.TraceError <ReplayConfiguration>((long)monitoredDatabase3.GetHashCode(), "Unable to monitor remote requests for configuration {0}", value);
                            if (monitoredDatabase2 != null)
                            {
                                RemoteDataProvider.s_databases.RemoveInstance(monitoredDatabase2);
                            }
                        }
                    }
                }
            }
            foreach (MonitoredDatabase monitoredDatabase4 in list)
            {
                monitoredDatabase4.StopMonitoring();
            }
            list.Clear();
        }